inherited fmDetiView: TfmDetiView
  Left = 442
  Top = 128
  Width = 1372
  Height = 920
  Caption = #1051#1102#1076#1080
  Constraints.MinHeight = 612
  Constraints.MinWidth = 812
  WindowState = wsMaximized
  OnShow = FormShow
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 855
    Width = 1356
    Visible = False
  end
  inherited Panel1: TPanel
    Top = 810
    Width = 1356
    Align = alBottom
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 1194
    end
    inherited BitBtn2: TBitBtn
      Left = 1282
    end
  end
  object Panel8: TPanel [2]
    Left = 0
    Top = 0
    Width = 1356
    Height = 151
    Align = alTop
    TabOrder = 2
    object Label1: TLabel
      Left = 1
      Top = 1
      Width = 1354
      Height = 19
      Align = alTop
      Caption = #1050#1088#1080#1090#1077#1088#1080#1080' '#1087#1086#1080#1089#1082#1072
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clGray
      Font.Height = -16
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
    end
    object Panel11: TPanel
      Left = 1366
      Top = 18
      Width = 237
      Height = 49
      TabOrder = 6
      Visible = False
      object Label31: TLabel
        Left = 55
        Top = 1
        Width = 95
        Height = 16
        Caption = #1044#1072#1090#1072' '#1079#1072#1074#1077#1076#1077#1085#1080#1103
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object eDataZaved: TcxButtonEdit
        Tag = 11
        Left = 3
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eDataZavedPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = True
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 0
        Width = 232
      end
    end
    object Panel2: TPanel
      Left = 1375
      Top = 34
      Width = 301
      Height = 49
      Align = alCustom
      TabOrder = 0
      Visible = False
      object Label5: TLabel
        Left = 2
        Top = 0
        Width = 46
        Height = 16
        Caption = #1042#1086#1079#1088#1072#1089#1090
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label2: TLabel
        Left = 137
        Top = 1
        Width = 45
        Height = 16
        Caption = #1053#1072' '#1076#1072#1090#1091
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label3: TLabel
        Left = 21
        Top = 21
        Width = 16
        Height = 16
        Caption = #1054#1090
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label4: TLabel
        Left = 76
        Top = 21
        Width = 18
        Height = 16
        Caption = #1044#1086
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label6: TLabel
        Left = 51
        Top = 1
        Width = 20
        Height = 16
        Caption = #1083#1077#1090
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label7: TLabel
        Left = 106
        Top = 1
        Width = 20
        Height = 16
        Caption = #1083#1077#1090
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object cxButton7: TcxButton
        Tag = 12
        Left = 269
        Top = 18
        Width = 27
        Height = 26
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 0
        TabStop = False
        OnClick = cxButton7Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object cxMaskEdit3: TcxMaskEdit
        Tag = 2
        Left = 101
        Top = 17
        ParentFont = False
        Properties.MaskKind = emkRegExpr
        Properties.EditMask = '\d+'
        Properties.MaxLength = 0
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -16
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.IsFontAssigned = True
        TabOrder = 1
        Width = 28
      end
      object cxMaskEdit1: TcxMaskEdit
        Tag = 1
        Left = 46
        Top = 17
        ParentFont = False
        Properties.MaskKind = emkRegExpr
        Properties.EditMask = '\d+'
        Properties.MaxLength = 0
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -16
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.IsFontAssigned = True
        TabOrder = 2
        Width = 28
      end
      object cxDateEdit1: TcxDateEdit
        Tag = 3
        Left = 134
        Top = 17
        ParentFont = False
        Properties.InputKind = ikStandard
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -16
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = []
        Style.TextStyle = [fsBold]
        Style.IsFontAssigned = True
        TabOrder = 3
        Width = 129
      end
    end
    object Panel3: TPanel
      Left = 1398
      Top = 42
      Width = 214
      Height = 49
      TabOrder = 1
      Visible = False
      object Label10: TLabel
        Left = -25
        Top = 1
        Width = 29
        Height = 16
        Caption = #1044#1072#1090#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label11: TLabel
        Left = 79
        Top = 1
        Width = 72
        Height = 16
        Caption = #1087#1088#1080#1089#1091#1090#1089#1090#1074#1080#1103
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object eDataPrisut: TcxButtonEdit
        Tag = 11
        Left = 5
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eDataPrisutPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = True
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 0
        Width = 206
      end
    end
    object Panel6: TPanel
      Left = 1341
      Top = 82
      Width = 388
      Height = 49
      TabOrder = 2
      Visible = False
      object Label16: TLabel
        Left = 42
        Top = 3
        Width = 54
        Height = 16
        Caption = #1076#1086#1075#1086#1074#1086#1088#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label22: TLabel
        Left = 10
        Top = 3
        Width = 29
        Height = 16
        Caption = #1044#1072#1090#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object eAgr: TcxButtonEdit
        Tag = 99
        Left = 3
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = cxButtonEdit1PropertiesButtonClick
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = True
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 0
        Width = 232
      end
      object cbAgr: TcxCheckBox
        Tag = 19
        Left = 243
        Top = 15
        Caption = #1054#1090#1089#1091#1090'. '#1076#1086#1075#1086#1074#1086#1088#1072
        ParentFont = False
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.Shadow = True
        Style.IsFontAssigned = True
        TabOrder = 1
        Width = 137
      end
    end
    object Panel5: TPanel
      Left = 1070
      Top = 72
      Width = 795
      Height = 38
      TabOrder = 3
      Visible = False
      object Label15: TLabel
        Left = 23
        Top = 3
        Width = 22
        Height = 16
        Caption = #1058#1080#1087
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label24: TLabel
        Left = 3
        Top = 16
        Width = 61
        Height = 16
        Caption = #1076#1086#1082#1091#1084#1077#1085#1090#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object eDoc: TcxButtonEdit
        Tag = 15
        Left = 70
        Top = 9
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eDocPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = True
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 0
        Width = 531
      end
      object cxButton5: TcxButton
        Tag = 12
        Left = 751
        Top = 7
        Width = 27
        Height = 26
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 1
        TabStop = False
        OnClick = cxButton5Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object cbDoc2: TcxCheckBox
        Tag = 20
        Left = 689
        Top = 8
        Caption = #1054#1090#1089'.'
        ParentFont = False
        Properties.OnChange = cbDoc2PropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.Shadow = True
        Style.IsFontAssigned = True
        TabOrder = 2
        Width = 56
      end
      object cbDoc: TcxCheckBox
        Tag = 18
        Left = 610
        Top = 8
        Caption = #1053#1072#1083#1080#1095#1080#1077
        ParentFont = False
        Properties.OnChange = cbDocPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.Shadow = True
        Style.IsFontAssigned = True
        TabOrder = 3
        Width = 83
      end
    end
    object SearchNow: TcxButton
      Left = 990
      Top = 80
      Width = 100
      Height = 37
      Caption = #1048#1089#1082#1072#1090#1100'!'
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -19
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      TabOrder = 4
      OnClick = SearchNowClick
      LookAndFeel.SkinName = 'Blue'
    end
    object Panel9: TPanel
      Left = 1614
      Top = 15
      Width = 291
      Height = 38
      TabOrder = 5
      Visible = False
      object Label23: TLabel
        Left = 7
        Top = 10
        Width = 80
        Height = 16
        Caption = #1040#1082#1090#1091#1072#1083#1100#1085#1086#1089#1090#1100
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object eActualn: TcxButtonEdit
        Tag = 17
        Left = 94
        Top = 6
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eActualnPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = True
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 0
        Width = 163
      end
      object cxButton4: TcxButton
        Tag = 12
        Left = 260
        Top = 5
        Width = 27
        Height = 26
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 1
        TabStop = False
        OnClick = cxButton4Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
    end
    object cbVnutri: TcxCheckBox
      Tag = 21
      Left = 11
      Top = 124
      Caption = #1053#1072' '#1090#1077#1088#1088#1080#1090'.'
      ParentFont = False
      Properties.OnChange = eActualnPropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = [fsBold]
      Style.Shadow = False
      Style.IsFontAssigned = True
      TabOrder = 7
      Width = 97
    end
    object bReload: TcxButton
      Left = 1094
      Top = 80
      Width = 68
      Height = 37
      Caption = #1054#1073#1085'.'
      Enabled = False
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      TabOrder = 8
      OnClick = bReloadClick
      Glyph.Data = {
        DE010000424DDE01000000000000760000002800000024000000120000000100
        0400000000006801000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333444444
        33333333333F7777773F33330000324334222222443333377F3733333377F333
        000032244222222222433337F7733FFFFF337F3300003222222AAAAA22243337
        F333F77777F337F30000322222A33333A2224337F33F7333337F337F00003222
        223333333A224337F33733333337F37F00003222222333333A444337FFFF7F33
        3337777300003AAAAAAA33333333333777777733333333330000333333333333
        333333333333333333FFFFFF000033333333333344444433FFFF333333777777
        00003A444333333A22222437777F333337F3333700003A2243333333A2222437
        F37F333333733337000033A224333334422224337337FFFFF7733337000033A2
        22444442222224337F3377777333FF370000333A2222222222AA243337FF3333
        33FF77F700003333AA222222AA33A3333377FFFFFF7733730000333333AAAAAA
        3333333333337777773333330000333333333333333333333333333333333333
        0000}
      LookAndFeel.SkinName = 'Caramel'
      NumGlyphs = 2
    end
    object Panel19: TPanel
      Left = 5
      Top = 75
      Width = 978
      Height = 48
      TabOrder = 9
      object Label12: TLabel
        Left = 8
        Top = 3
        Width = 47
        Height = 16
        Caption = #1059#1089#1083#1091#1075#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label18: TLabel
        Left = 696
        Top = -1
        Width = 42
        Height = 14
        Caption = #1059#1089#1083#1091#1075#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -12
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label8: TLabel
        Left = 777
        Top = 6
        Width = 42
        Height = 14
        Caption = #1085#1072' '#1076#1072#1090#1091
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -12
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label20: TLabel
        Left = 691
        Top = 13
        Width = 59
        Height = 14
        Caption = #1086#1090#1089#1091#1090#1089#1090#1074'.'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -12
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object cxButton11: TcxButton
        Tag = 97
        Left = 650
        Top = 18
        Width = 25
        Height = 25
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 0
        TabStop = False
        OnClick = cxButton11Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object eService: TcxButtonEdit
        Tag = 97
        Left = 8
        Top = 19
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eServicePropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 1
        Width = 641
      end
      object eUslugaDate: TcxButtonEdit
        Tag = 950
        Left = 776
        Top = 21
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eUslugaDatePropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 2
        Width = 193
      end
      object cbNotExistsUslugi: TcxCheckBox
        Tag = 502
        Left = 709
        Top = 25
        ParentFont = False
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = []
        Style.Shadow = False
        Style.IsFontAssigned = True
        TabOrder = 3
        Width = 24
      end
    end
    object cbUniq: TcxCheckBox
      Tag = 500
      Left = 325
      Top = 124
      Caption = #1059#1085#1080#1082#1072#1083#1100#1085'.'
      ParentFont = False
      Properties.OnChange = eActualnPropertiesChange
      Style.Font.Charset = DEFAULT_CHARSET
      Style.Font.Color = clWindowText
      Style.Font.Height = -13
      Style.Font.Name = 'Tahoma'
      Style.Font.Style = [fsBold]
      Style.Shadow = False
      Style.IsFontAssigned = True
      TabOrder = 10
      Width = 97
    end
    object Panel4: TPanel
      Left = 6
      Top = 24
      Width = 977
      Height = 48
      TabOrder = 11
      object Label13: TLabel
        Left = 3
        Top = 1
        Width = 153
        Height = 16
        Caption = #1054#1073#1088#1072#1079'. '#1087#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1077
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label14: TLabel
        Left = 493
        Top = 1
        Width = 95
        Height = 16
        Caption = #1044#1086#1087'. '#1087#1086#1076#1088#1072#1079#1076'.'
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label9: TLabel
        Left = 301
        Top = 1
        Width = 44
        Height = 16
        Caption = #1085#1072' '#1076#1072#1090#1091
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object Label17: TLabel
        Left = 777
        Top = 1
        Width = 44
        Height = 16
        Caption = #1085#1072' '#1076#1072#1090#1091
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = []
        ParentFont = False
      end
      object eOsnPodrazd: TcxButtonEdit
        Tag = 10
        Left = 2
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eOsnPodrazdPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 0
        Width = 271
      end
      object eDopPodrazd: TcxButtonEdit
        Tag = 11
        Left = 491
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eDopPodrazdPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 1
        Width = 258
      end
      object cxButton6: TcxButton
        Tag = 12
        Left = 274
        Top = 17
        Width = 18
        Height = 22
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 2
        TabStop = False
        OnClick = cxButton6Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object eOsnPodrDate: TcxButtonEdit
        Tag = 950
        Left = 296
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eOsnPodrDatePropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 3
        Width = 177
      end
      object eDopPodrDate: TcxButtonEdit
        Tag = 950
        Left = 776
        Top = 17
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eDopPodrDatePropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 4
        Width = 193
      end
      object cxButton14: TcxButton
        Tag = 12
        Left = 751
        Top = 17
        Width = 18
        Height = 22
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 5
        TabStop = False
        OnClick = cxButton14Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object Panel18: TPanel
        Left = 474
        Top = 2
        Width = 13
        Height = 45
        TabOrder = 6
      end
    end
    object Panel7: TPanel
      Left = 985
      Top = 24
      Width = 176
      Height = 48
      TabOrder = 12
      object Label19: TLabel
        Left = 8
        Top = 3
        Width = 45
        Height = 16
        Caption = #1057#1090#1072#1090#1091#1089
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object Label21: TLabel
        Left = 60
        Top = 3
        Width = 65
        Height = 16
        Caption = #1095#1077#1083#1086#1074#1077#1082#1072
        Font.Charset = DEFAULT_CHARSET
        Font.Color = clGray
        Font.Height = -13
        Font.Name = 'Tahoma'
        Font.Style = [fsBold]
        ParentFont = False
      end
      object cxButton9: TcxButton
        Tag = 12
        Left = 147
        Top = 17
        Width = 24
        Height = 24
        Hint = #1054#1095#1080#1089#1090#1080#1090#1100
        ParentShowHint = False
        ShowHint = True
        TabOrder = 0
        TabStop = False
        OnClick = cxButton9Click
        Glyph.Data = {
          76010000424D7601000000000000760000002800000020000000100000000100
          0400000000000001000000000000000000001000000000000000000000000000
          8000008000000080800080000000800080008080000080808000C0C0C0000000
          FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
          3333333333333333333333333333333333333333333333333333333333333333
          3333333333333333333333337333333333333333F33333333333333313333333
          333333337F33333333333333113333713333333377F33377F333333371733717
          3333333377F3377F333333333117311333333333377F377F3333333337111133
          33333333337777F33333333337111333333333333F777F333333333371111733
          3333333337777F3333333333117311733333333377F377F33333333333333117
          333333333333377F33333333333333117333333333333377F333333333333333
          3333333333333333333333333333333333333333333333333333}
        LookAndFeel.SkinName = ''
        NumGlyphs = 2
      end
      object eStatus: TcxButtonEdit
        Tag = 12
        Left = 8
        Top = 18
        ParentFont = False
        Properties.Buttons = <
          item
            Glyph.Data = {
              F6000000424DF600000000000000760000002800000010000000100000000100
              0400000000008000000000000000000000001000000000000000000000000000
              8000008000000080800080000000800080008080000080808000C0C0C0000000
              FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFF0FFFFFFFFFFFFFF000FFFFFFFFFFFF00000FFFFFFFFFF0000000F
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
              FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF}
          end>
        Properties.MaxLength = 0
        Properties.ReadOnly = True
        Properties.OnButtonClick = eStatusPropertiesButtonClick
        Properties.OnChange = eActualnPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -12
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = []
        Style.LookAndFeel.SkinName = ''
        Style.Shadow = False
        Style.IsFontAssigned = True
        StyleDisabled.LookAndFeel.SkinName = ''
        StyleFocused.LookAndFeel.SkinName = ''
        StyleHot.LookAndFeel.SkinName = ''
        TabOrder = 1
        Width = 137
      end
    end
    object bRastorj: TcxButton
      Left = 108
      Top = 125
      Width = 100
      Height = 21
      Caption = #1056#1072#1089#1090#1086#1088#1078#1077#1085#1080#1077
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 13
      OnClick = bRastorjClick
      LookAndFeel.SkinName = 'Office2007Green'
    end
    object bNotBalance: TcxButton
      Left = 212
      Top = 125
      Width = 100
      Height = 21
      Caption = #1056#1072#1089#1073#1072#1083#1083#1072#1085#1089
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = []
      ParentFont = False
      TabOrder = 14
      Visible = False
      OnClick = bNotBalanceClick
      LookAndFeel.SkinName = 'Office2007Green'
    end
    object bShowForApproved: TcxButton
      Tag = 12
      Left = 428
      Top = 125
      Width = 111
      Height = 21
      Caption = #1044#1057' '#1076#1083#1103' '#1091#1090#1074#1077#1088#1078#1076'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 15
      TabStop = False
      OnClick = bShowForApprovedClick
      LookAndFeel.SkinName = 'Office2007Green'
    end
    object bCrossAgr: TcxButton
      Tag = 12
      Left = 544
      Top = 125
      Width = 97
      Height = 21
      Caption = #1055#1077#1088#1077#1089#1077#1082'. '#1076#1086#1075'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 16
      TabStop = False
      OnClick = bCrossAgrClick
      LookAndFeel.SkinName = 'Office2007Green'
    end
    object bSCInvaliDateEnd: TcxButton
      Tag = 12
      Left = 645
      Top = 125
      Width = 156
      Height = 21
      Caption = #1044#1072#1090#1072' '#1086#1082#1086#1085#1095'. '#1044#1057' > '#1076#1072#1090#1099' '#1076#1086#1075'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 17
      TabStop = False
      OnClick = bSCInvaliDateEndClick
      LookAndFeel.SkinName = 'Office2007Green'
    end
  end
  object Panel10: TPanel [3]
    Left = 0
    Top = 159
    Width = 1356
    Height = 26
    Align = alTop
    BevelOuter = bvNone
    TabOrder = 4
    object cxButton1: TcxButton
      Tag = 12
      Left = 6
      Top = 2
      Width = 106
      Height = 23
      Caption = #1056#1077#1076#1072#1082#1090'. '#1095#1077#1083#1086#1074#1077#1082#1072
      ParentShowHint = False
      ShowHint = True
      TabOrder = 0
      TabStop = False
      OnClick = cxButton1Click
      LookAndFeel.SkinName = 'Blue'
    end
    object cxButton2: TcxButton
      Tag = 12
      Left = 1232
      Top = 2
      Width = 89
      Height = 23
      Caption = #1044#1086#1073#1072#1074#1080#1090#1100' '#1076#1086#1082'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 1
      TabStop = False
      Visible = False
      OnClick = cxButton2Click
      LookAndFeel.SkinName = 'Blue'
    end
    object cxButton3: TcxButton
      Tag = 12
      Left = 1088
      Top = 2
      Width = 73
      Height = 23
      Caption = #1044#1086#1073#1072#1074#1080#1090#1100'/'#1080#1079#1084'. '#1092#1086#1090#1086
      ParentShowHint = False
      ShowHint = True
      TabOrder = 2
      TabStop = False
      Visible = False
      OnClick = cxButton3Click
      LookAndFeel.SkinName = 'Blue'
    end
    object cxButton8: TcxButton
      Tag = 12
      Left = 1323
      Top = 2
      Width = 38
      Height = 23
      Caption = #1044#1086#1073'. '#1095#1077#1083#1086#1074#1077#1082#1072
      ParentShowHint = False
      ShowHint = True
      TabOrder = 3
      TabStop = False
      Visible = False
      OnClick = cxButton8Click
      LookAndFeel.SkinName = 'Blue'
    end
    object bRaspr: TcxButton
      Tag = 12
      Left = 1040
      Top = 2
      Width = 49
      Height = 23
      Caption = #1055#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1103
      ParentShowHint = False
      ShowHint = True
      TabOrder = 4
      TabStop = False
      Visible = False
      OnClick = bRasprClick
      LookAndFeel.SkinName = 'Blue'
    end
    object bExpToExcel: TcxButton
      Tag = 12
      Left = 545
      Top = 2
      Width = 113
      Height = 23
      Caption = #1069#1082#1089#1087#1086#1088#1090' '#1074' Excel'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 5
      TabStop = False
      OnClick = bExpToExcelClick
      Glyph.Data = {
        F6000000424DF600000000000000760000002800000010000000100000000100
        0400000000008000000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333300003
        30003333000088000EE033330FFF0880EE0033330F77708EE00333330FFFF0EE
        800333000F770EE0880033090FF0EE0F0880000990F000FFF00009999907FF77
        7F0309999990FFFFFF030999990FF7000003000990FFFF0FF03333090FFF770F
        033333000FFFFF00333333330000000333333333333333333333}
      LookAndFeel.SkinName = 'Blue'
    end
    object bGridCust: TcxButton
      Tag = 12
      Left = 660
      Top = 2
      Width = 27
      Height = 23
      Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
      ParentShowHint = False
      ShowHint = True
      TabOrder = 6
      TabStop = False
      OnClick = bGridCustClick
      Glyph.Data = {
        76010000424D7601000000000000760000002800000020000000100000000100
        04000000000000010000120B0000120B00001000000000000000000000000000
        80000080000000808000800000008000800080800000C0C0C000808080000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
        33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
        FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
        FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
        FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
        FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
        FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
        C77087F7888888888FF809090000000000008787888888888888399333333333
        3333377333333333333333333333333333333333333333333333}
      LookAndFeel.SkinName = 'Blue'
      NumGlyphs = 2
    end
    object bKPPMessage: TcxButton
      Tag = 12
      Left = 1168
      Top = 2
      Width = 59
      Height = 23
      Caption = #1050#1086#1085#1090#1088#1086#1083#1100' '#1074#1093#1086#1076#1072
      ParentShowHint = False
      ShowHint = True
      TabOrder = 7
      TabStop = False
      Visible = False
      OnClick = bKPPMessageClick
      LookAndFeel.SkinName = 'Caramel'
    end
    object bSCCopy: TcxButton
      Tag = 12
      Left = 1368
      Top = 2
      Width = 49
      Height = 23
      Caption = #1050#1086#1087#1080#1103' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 8
      TabStop = False
      Visible = False
      OnClick = bSCCopyClick
      LookAndFeel.SkinName = 'Caramel'
    end
    object bResetGPChange: TcxButton
      Tag = 12
      Left = 848
      Top = 2
      Width = 111
      Height = 23
      Caption = #1054#1090#1084#1077#1085#1072' '#1080#1079#1084'. '#1075#1088#1072#1092#1080#1082
      ParentShowHint = False
      ShowHint = True
      TabOrder = 9
      TabStop = False
      Visible = False
      OnClick = bResetGPChangeClick
      LookAndFeel.SkinName = 'Blue'
    end
    object bPrintFinanceState: TcxButton
      Tag = 12
      Left = 967
      Top = 2
      Width = 138
      Height = 23
      Hint = #1055#1077#1095#1072#1090#1100' '#1076#1086#1083#1075#1086#1074
      Caption = #1056#1072#1089#1095#1077#1090#1099' '#1087#1086' '#1091#1089#1083#1091#1075#1072#1084
      ParentShowHint = False
      ShowHint = False
      TabOrder = 10
      TabStop = False
      Visible = False
      OnClick = bPrintFinanceStateClick
      Glyph.Data = {
        76010000424D7601000000000000760000002800000020000000100000000100
        04000000000000010000130B0000130B00001000000000000000000000000000
        800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00300000000000
        00033FFFFFFFFFFFFFFF0888888888888880777777777777777F088888888888
        8880777777777777777F0000000000000000FFFFFFFFFFFFFFFF0F8F8F8F8F8F
        8F80777777777777777F08F8F8F8F8F8F9F0777777777777777F0F8F8F8F8F8F
        8F807777777777777F7F0000000000000000777777777777777F3330FFFFFFFF
        03333337F3FFFF3F7F333330F0000F0F03333337F77773737F333330FFFFFFFF
        03333337F3FF3FFF7F333330F00F000003333337F773777773333330FFFF0FF0
        33333337F3FF7F3733333330F08F0F0333333337F7737F7333333330FFFF0033
        33333337FFFF7733333333300000033333333337777773333333}
      LookAndFeel.SkinName = 'Blue'
      NumGlyphs = 2
    end
    object bDocProblem: TcxButton
      Tag = 12
      Left = 115
      Top = 2
      Width = 110
      Height = 23
      Caption = #1055#1088#1086#1073#1083#1077#1084#1085#1099#1077' '#1076#1086#1082'.'
      ParentShowHint = False
      ShowHint = False
      TabOrder = 11
      TabStop = False
      OnClick = bDocProblemClick
      LookAndFeel.SkinName = 'Blue'
    end
    object cbPanelSecond: TcxCheckBox
      Left = 244
      Top = -4
      Caption = #1055#1086#1082#1072#1079#1072#1090#1100' '#1076#1086#1087'. '#1074#1082#1083#1072#1076#1082#1091
      Properties.Alignment = taLeftJustify
      Properties.MultiLine = True
      Properties.NullStyle = nssUnchecked
      Properties.OnChange = cbPanelSecondPropertiesChange
      Style.LookAndFeel.SkinName = 'Blue'
      StyleDisabled.LookAndFeel.SkinName = 'Blue'
      StyleFocused.LookAndFeel.SkinName = 'Blue'
      StyleHot.LookAndFeel.SkinName = 'Blue'
      TabOrder = 12
      Width = 93
    end
    object bAddSC_multi: TcxButton
      Tag = 12
      Left = 690
      Top = 2
      Width = 111
      Height = 23
      Caption = #1057#1086#1079#1076'. '#1044#1057' '#1087#1086' '#1096#1072#1073#1083'.'
      ParentShowHint = False
      ShowHint = True
      TabOrder = 13
      TabStop = False
      OnClick = bAddSC_multiClick
      LookAndFeel.SkinName = 'Blue'
    end
    object bCanTempDel: TcxButton
      Left = 360
      Top = 2
      Width = 75
      Height = 22
      Caption = #1056#1077#1078#1080#1084' '#1091#1076#1072#1083'.'
      TabOrder = 14
      Colors.Default = clSkyBlue
      Colors.Pressed = clMaroon
      Colors.PressedText = clWhite
      LookAndFeel.Kind = lfFlat
      LookAndFeel.SkinName = ''
      SpeedButtonOptions.GroupIndex = 1
      SpeedButtonOptions.AllowAllUp = True
    end
    object bTempEnter: TcxButton
      Tag = 12
      Left = 440
      Top = 2
      Width = 102
      Height = 23
      Caption = #1056#1072#1079#1088#1077#1096#1080#1090#1100' '#1074#1093#1086#1076
      ParentShowHint = False
      ShowHint = True
      TabOrder = 15
      TabStop = False
      OnClick = bTempEnterClick
      LookAndFeel.SkinName = 'Office2007Pink'
    end
    object btAgreementByTemplateAdd: TcxButton
      Left = 803
      Top = 2
      Width = 158
      Height = 23
      Caption = #1057#1086#1079#1076#1072#1090#1100' '#1076#1086#1075#1086#1074#1086#1088' '#1087#1086' '#1096#1072#1073#1083#1086#1085#1091
      TabOrder = 16
      OnClick = btAgreementByTemplateAddClick
      LookAndFeel.SkinName = 'Blue'
    end
  end
  object Panel13: TPanel [4]
    Left = 0
    Top = 512
    Width = 1356
    Height = 298
    Align = alBottom
    TabOrder = 5
    object cxPageControl1: TcxPageControl
      Left = 1
      Top = 1
      Width = 1315
      Height = 296
      ActivePage = tsRodstv
      Align = alClient
      LookAndFeel.Kind = lfUltraFlat
      LookAndFeel.NativeStyle = False
      LookAndFeel.SkinName = 'Blue'
      TabOrder = 0
      TabSlants.Kind = skCutCorner
      TabSlants.Positions = [spRight]
      OnDblClick = cxPageControl1DblClick
      ClientRectBottom = 291
      ClientRectLeft = 2
      ClientRectRight = 1310
      ClientRectTop = 25
      object tsAgr: TcxTabSheet
        Caption = #1044#1086#1075#1086#1074#1086#1088#1099' '#1080' '#1091#1089#1083#1091#1075#1080
        ImageIndex = 0
        OnHide = tsAgrHide
        OnShow = tsAgrShow
        object Panel_agr: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          Caption = 'Panel_agr'
          TabOrder = 0
          object Panel17: TPanel
            Left = 1
            Top = 1
            Width = 1000
            Height = 264
            Align = alLeft
            TabOrder = 0
            object Panel15: TPanel
              Left = 1
              Top = 1
              Width = 998
              Height = 32
              Align = alTop
              TabOrder = 0
              DesignSize = (
                998
                32)
              object Label25: TLabel
                Left = 8
                Top = 7
                Width = 67
                Height = 16
                Caption = #1044#1086#1075#1086#1074#1086#1088#1099
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clGray
                Font.Height = -13
                Font.Name = 'Tahoma'
                Font.Style = [fsBold]
                ParentFont = False
              end
              object bAgr: TcxButton
                Tag = 12
                Left = 83
                Top = 4
                Width = 29
                Height = 24
                Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1076#1086#1075#1086#1074#1086#1088' '#1091#1089#1083#1091#1075
                ParentShowHint = False
                ShowHint = True
                TabOrder = 0
                TabStop = False
                OnClick = bAgrClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  04000000000000010000CE0E0000D80E00001000000000000000000000000000
                  80000080000000808000800000008000800080800000C0C0C000808080000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                  3333333333387F3333333333333333333333333333387F333333333333344333
                  3333333333387F3333333333333443333333333333387F333333333333344333
                  3333333333387F3333333333333443333333333333387F333333333333344333
                  3333387FFFFFFFFFFFFF3344444444444433387777777F777777334444444444
                  4433388888887F8888883333333443333333333333387F333333333333344333
                  3333333333387F3333333333333443333333333333387F333333333333344333
                  3333333333387F33333333333334433333333333333877333333333333333333
                  3333333333388833333333333333333333333333333333333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object bAgrPrint: TcxButton
                Tag = 12
                Left = 147
                Top = 4
                Width = 30
                Height = 24
                Hint = #1055#1077#1095#1072#1090#1100' '#1076#1086#1075#1086#1074#1086#1088#1072
                ParentShowHint = False
                ShowHint = True
                TabOrder = 1
                TabStop = False
                OnClick = bAgrPrintClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  04000000000000010000130B0000130B00001000000000000000000000000000
                  800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00300000000000
                  00033FFFFFFFFFFFFFFF0888888888888880777777777777777F088888888888
                  8880777777777777777F0000000000000000FFFFFFFFFFFFFFFF0F8F8F8F8F8F
                  8F80777777777777777F08F8F8F8F8F8F9F0777777777777777F0F8F8F8F8F8F
                  8F807777777777777F7F0000000000000000777777777777777F3330FFFFFFFF
                  03333337F3FFFF3F7F333330F0000F0F03333337F77773737F333330FFFFFFFF
                  03333337F3FF3FFF7F333330F00F000003333337F773777773333330FFFF0FF0
                  33333337F3FF7F3733333330F08F0F0333333337F7737F7333333330FFFF0033
                  33333337FFFF7733333333300000033333333337777773333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object bDelAgr: TcxButton
                Tag = 12
                Left = 116
                Top = 4
                Width = 27
                Height = 24
                Hint = #1059#1076#1072#1083#1080#1090#1100' '#1076#1086#1075#1086#1074#1086#1088
                ParentShowHint = False
                ShowHint = True
                TabOrder = 2
                TabStop = False
                OnClick = bDelAgrClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  0400000000000001000000000000000000001000000000000000000000000000
                  8000008000000080800080000000800080008080000080808000C0C0C0000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                  3333333333333333333333333333333333333333333333333333333333333333
                  3333333333333333333333337333333333333333F33333333333333313333333
                  333333337F33333333333333113333713333333377F33377F333333371733717
                  3333333377F3377F333333333117311333333333377F377F3333333337111133
                  33333333337777F33333333337111333333333333F777F333333333371111733
                  3333333337777F3333333333117311733333333377F377F33333333333333117
                  333333333333377F33333333333333117333333333333377F333333333333333
                  3333333333333333333333333333333333333333333333333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object rgAgr: TcxRadioGroup
                Left = 792
                Top = -3
                Anchors = [akTop, akRight]
                Properties.Columns = 2
                Properties.Items = <
                  item
                    Caption = #1055#1088#1072#1074'. '#1076#1086#1075'.'
                    Value = 0
                  end
                  item
                    Caption = #1059#1076#1072#1083'. '#1076#1086#1075'.'
                    Value = 1
                  end>
                Properties.OnChange = rgAgrPropertiesChange
                ItemIndex = 0
                TabOrder = 3
                Height = 31
                Width = 201
              end
              object bShowColAgr: TcxButton
                Tag = 12
                Left = 758
                Top = 4
                Width = 28
                Height = 23
                Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
                Anchors = [akTop, akRight]
                ParentShowHint = False
                ShowHint = True
                TabOrder = 4
                TabStop = False
                OnClick = bShowColAgrClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  04000000000000010000120B0000120B00001000000000000000000000000000
                  80000080000000808000800000008000800080800000C0C0C000808080000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                  33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
                  FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
                  FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
                  FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
                  FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
                  FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
                  C77087F7888888888FF809090000000000008787888888888888399333333333
                  3333377333333333333333333333333333333333333333333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object lcbPeriod: TcxLookupComboBox
                Left = 344
                Top = 6
                Properties.DropDownRows = 15
                Properties.KeyFieldNames = 'id'
                Properties.ListColumns = <
                  item
                    FieldName = 'TRIMESTR'
                  end
                  item
                    FieldName = 'BEGDATE'
                  end
                  item
                    FieldName = 'ENDDATE'
                  end>
                Properties.ListOptions.ShowHeader = False
                Properties.ListSource = dsPeriod
                Properties.OnCloseUp = cxLookupComboBox1PropertiesCloseUp
                Style.LookAndFeel.SkinName = 'Office2007Blue'
                StyleDisabled.LookAndFeel.SkinName = 'Office2007Blue'
                StyleFocused.LookAndFeel.SkinName = 'Office2007Blue'
                StyleHot.LookAndFeel.SkinName = 'Office2007Blue'
                TabOrder = 5
                Width = 265
              end
              object bPrintBalance: TcxButton
                Left = 613
                Top = 4
                Width = 25
                Height = 25
                TabOrder = 6
                OnClick = bPrintBalanceClick
                Glyph.Data = {
                  F6000000424DF600000000000000760000002800000010000000100000000100
                  0400000000008000000000000000000000001000000000000000000000000000
                  8000008000000080800080000000800080008080000080808000C0C0C0000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00888888888888
                  888F8800000000000888808888888880808800000000000008080888888BBB88
                  0008088888877788080800000000000008800888888888808080800000000008
                  0800880FFFFFFFF080808880F00000F000088880FFFFFFFF088888880F00000F
                  088888880FFFFFFFF08888888000000000888888888888888888}
                LookAndFeel.SkinName = 'Office2007Blue'
              end
              object cxLabel1: TcxLabel
                Left = 184
                Top = 7
                Caption = #1055#1077#1095#1072#1090#1100' '#1073#1072#1083#1072#1085#1089#1072' '#1087#1086' '#1087#1086#1083#1091#1095'. '#1091#1089#1083'.'
                Style.LookAndFeel.SkinName = 'Office2007Blue'
                StyleDisabled.LookAndFeel.SkinName = 'Office2007Blue'
                StyleFocused.LookAndFeel.SkinName = 'Office2007Blue'
                StyleHot.LookAndFeel.SkinName = 'Office2007Blue'
              end
              object cbActiveAgr: TcxCheckBox
                Left = 650
                Top = 6
                Anchors = [akTop, akRight]
                Caption = #1058#1086#1083#1100#1082#1086' '#1076#1077#1081#1089#1090#1074'.'
                Properties.OnChange = rgAgrPropertiesChange
                TabOrder = 8
                Width = 103
              end
            end
            object dbgAgr: TcxGrid
              Left = 1
              Top = 33
              Width = 998
              Height = 80
              Align = alTop
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -13
              Font.Name = 'Tahoma'
              Font.Style = []
              ParentFont = False
              TabOrder = 1
              LookAndFeel.Kind = lfStandard
              object tvAgr: TcxGridDBTableView
                NavigatorButtons.ConfirmDelete = False
                OnCellDblClick = tvAgrCellDblClick
                DataController.DataSource = dsAgr
                DataController.Summary.DefaultGroupSummaryItems = <>
                DataController.Summary.FooterSummaryItems = <>
                DataController.Summary.SummaryGroups = <>
                OptionsBehavior.CellHints = True
                OptionsCustomize.ColumnFiltering = False
                OptionsData.CancelOnExit = False
                OptionsData.Deleting = False
                OptionsData.DeletingConfirmation = False
                OptionsData.Editing = False
                OptionsData.Inserting = False
                OptionsView.CellEndEllipsis = True
                OptionsView.CellAutoHeight = True
                OptionsView.CellTextMaxLineCount = 1
                OptionsView.ColumnAutoWidth = True
                OptionsView.GroupByBox = False
                OptionsView.HeaderEndEllipsis = True
                Preview.Visible = True
                Styles.Header = DMInv.cxSiniyText
                object tvAgrColumn1: TcxGridDBColumn
                  Caption = #8470
                  OnGetDataText = tvAgrColumn1GetDataText
                  Options.Editing = False
                  Options.Moving = False
                  Options.Sorting = False
                  Width = 20
                end
                object tvAgrAGID: TcxGridDBColumn
                  Caption = #8470' '#1089#1082#1074#1086#1079#1085'.'
                  DataBinding.FieldName = 'AGID'
                  Options.Editing = False
                  Width = 27
                end
                object tvAgrP_RECIPIENT: TcxGridDBColumn
                  Caption = #1055#1086#1083#1091#1095'. '#1091#1089#1083#1091#1075
                  DataBinding.FieldName = 'P_RECIPIENT'
                  Width = 34
                end
                object tvAgrAGNUM_N: TcxGridDBColumn
                  Caption = #1053#1086#1084#1077#1088
                  DataBinding.FieldName = 'AGNUM_N'
                  Width = 20
                end
                object tvAgrAGNUM: TcxGridDBColumn
                  Caption = #8470' '#1085#1072' '#1076#1086#1082'.'
                  DataBinding.FieldName = 'AGNUM'
                  Width = 28
                end
                object tvAgrLIST: TcxGridDBColumn
                  Caption = #1055#1086#1076#1087#1080#1089#1072#1085#1090#1099
                  DataBinding.FieldName = 'LIST'
                  Width = 32
                end
                object tvAgrAGDATEBEGIN: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1074#1089#1090'. '#1074' '#1089#1080#1083#1091
                  DataBinding.FieldName = 'AGDATEBEGIN'
                  Width = 43
                end
                object tvAgrAGDATEEND: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1079#1072#1074#1077#1088#1096'.'
                  DataBinding.FieldName = 'AGDATEEND'
                  Width = 35
                end
                object tvAgrAGDATECLOSE: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1087#1088#1077#1078#1076'. '#1088#1072#1089#1090#1086#1088#1078'.'
                  DataBinding.FieldName = 'AGDATECLOSE'
                  Width = 55
                end
                object tvAgrAGNOTECLOSE: TcxGridDBColumn
                  Caption = #1055#1088#1080#1095#1080#1085#1072' '#1088#1072#1089#1090'.'
                  DataBinding.FieldName = 'AGNOTECLOSE'
                  Width = 44
                end
                object tvAgrAGNOTE: TcxGridDBColumn
                  Caption = #1050#1086#1084#1084#1077#1085#1090' '#1082' '#1076#1086#1075'.'
                  DataBinding.FieldName = 'AGNOTE'
                  Width = 50
                end
                object tvAgrISSCAN: TcxGridDBColumn
                  Caption = #1050#1086#1087#1080#1103
                  DataBinding.FieldName = 'ISSCAN'
                  PropertiesClassName = 'TcxCheckBoxProperties'
                  Properties.ReadOnly = True
                  Properties.ValueChecked = 1
                  Properties.ValueUnchecked = 0
                  Width = 24
                end
                object tvAgrPODRAZD: TcxGridDBColumn
                  Caption = #1057#1090#1088#1091#1082#1090'. '#1087#1086#1076#1088#1072#1079#1076'.'
                  DataBinding.FieldName = 'PODRAZD'
                  Width = 68
                end
                object tvAgrAGUSERENTER: TcxGridDBColumn
                  Caption = #1040#1074#1090#1086#1088
                  DataBinding.FieldName = 'AGUSERENTER'
                  Width = 29
                end
                object tvAgrAGTIMEENTER: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076'.'
                  DataBinding.FieldName = 'AGTIMEENTER'
                  Width = 50
                end
                object tvAgrAGUSEREDIT: TcxGridDBColumn
                  Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                  DataBinding.FieldName = 'AGUSEREDIT'
                  Width = 47
                end
                object tvAgrAGTIMEEDIT: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1088#1077#1076#1072#1082#1090'.'
                  DataBinding.FieldName = 'AGTIMEEDIT'
                  Width = 76
                end
              end
              object cxGridLevel1: TcxGridLevel
                GridView = tvAgr
              end
            end
            object Panel16: TPanel
              Left = 1
              Top = 121
              Width = 998
              Height = 37
              Align = alTop
              TabOrder = 2
              DesignSize = (
                998
                37)
              object Label29: TLabel
                Left = 8
                Top = 9
                Width = 68
                Height = 16
                Caption = #1044#1086#1087'. '#1089#1086#1075#1083'.'
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clGray
                Font.Height = -13
                Font.Name = 'Tahoma'
                Font.Style = [fsBold]
                ParentFont = False
              end
              object bAddSpec_Cond: TcxButton
                Tag = 12
                Left = 85
                Top = 5
                Width = 27
                Height = 24
                Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1077
                ParentShowHint = False
                ShowHint = True
                TabOrder = 0
                TabStop = False
                OnClick = bAddSpec_CondClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  04000000000000010000CE0E0000D80E00001000000000000000000000000000
                  80000080000000808000800000008000800080800000C0C0C000808080000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                  3333333333387F3333333333333333333333333333387F333333333333344333
                  3333333333387F3333333333333443333333333333387F333333333333344333
                  3333333333387F3333333333333443333333333333387F333333333333344333
                  3333387FFFFFFFFFFFFF3344444444444433387777777F777777334444444444
                  4433388888887F8888883333333443333333333333387F333333333333344333
                  3333333333387F3333333333333443333333333333387F333333333333344333
                  3333333333387F33333333333334433333333333333877333333333333333333
                  3333333333388833333333333333333333333333333333333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object bSCPrint: TcxButton
                Tag = 12
                Left = 145
                Top = 4
                Width = 30
                Height = 25
                Hint = #1055#1077#1095#1072#1090#1100' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1103
                ParentShowHint = False
                ShowHint = True
                TabOrder = 1
                TabStop = False
                OnClick = bSCPrintClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  04000000000000010000130B0000130B00001000000000000000000000000000
                  800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00300000000000
                  00033FFFFFFFFFFFFFFF0888888888888880777777777777777F088888888888
                  8880777777777777777F0000000000000000FFFFFFFFFFFFFFFF0F8F8F8F8F8F
                  8F80777777777777777F08F8F8F8F8F8F9F0777777777777777F0F8F8F8F8F8F
                  8F807777777777777F7F0000000000000000777777777777777F3330FFFFFFFF
                  03333337F3FFFF3F7F333330F0000F0F03333337F77773737F333330FFFFFFFF
                  03333337F3FF3FFF7F333330F00F000003333337F773777773333330FFFF0FF0
                  33333337F3FF7F3733333330F08F0F0333333337F7737F7333333330FFFF0033
                  33333337FFFF7733333333300000033333333337777773333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object cxButton10: TcxButton
                Tag = 12
                Left = 968
                Top = 6
                Width = 28
                Height = 23
                Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
                Anchors = [akTop, akRight]
                ParentShowHint = False
                ShowHint = True
                TabOrder = 2
                TabStop = False
                OnClick = cxButton10Click
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  04000000000000010000120B0000120B00001000000000000000000000000000
                  80000080000000808000800000008000800080800000C0C0C000808080000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                  33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
                  FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
                  FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
                  FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
                  FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
                  FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
                  C77087F7888888888FF809090000000000008787888888888888399333333333
                  3333377333333333333333333333333333333333333333333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object bDelSC: TcxButton
                Tag = 12
                Left = 114
                Top = 5
                Width = 27
                Height = 24
                Hint = #1059#1076#1072#1083#1080#1090#1100' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1077
                ParentShowHint = False
                ShowHint = True
                TabOrder = 3
                TabStop = False
                OnClick = bDelSCClick
                Glyph.Data = {
                  76010000424D7601000000000000760000002800000020000000100000000100
                  0400000000000001000000000000000000001000000000000000000000000000
                  8000008000000080800080000000800080008080000080808000C0C0C0000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                  3333333333333333333333333333333333333333333333333333333333333333
                  3333333333333333333333337333333333333333F33333333333333313333333
                  333333337F33333333333333113333713333333377F33377F333333371733717
                  3333333377F3377F333333333117311333333333377F377F3333333337111133
                  33333333337777F33333333337111333333333333F777F333333333371111733
                  3333333337777F3333333333117311733333333377F377F33333333333333117
                  333333333333377F33333333333333117333333333333377F333333333333333
                  3333333333333333333333333333333333333333333333333333}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object cxButton12: TcxButton
                Tag = 12
                Left = 180
                Top = 4
                Width = 27
                Height = 25
                Hint = #1054#1073#1085#1086#1074#1080#1090#1100' '#1076#1072#1085#1085#1099#1077
                ParentShowHint = False
                ShowHint = True
                TabOrder = 4
                TabStop = False
                OnClick = cxButton12Click
                Glyph.Data = {
                  DE010000424DDE01000000000000760000002800000024000000120000000100
                  0400000000006801000000000000000000001000000000000000000000000000
                  8000008000000080800080000000800080008080000080808000C0C0C0000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333444444
                  33333333333F7777773F33330000324334222222443333377F3733333377F333
                  000032244222222222433337F7733FFFFF337F3300003222222AAAAA22243337
                  F333F77777F337F30000322222A33333A2224337F33F7333337F337F00003222
                  223333333A224337F33733333337F37F00003222222333333A444337FFFF7F33
                  3337777300003AAAAAAA33333333333777777733333333330000333333333333
                  333333333333333333FFFFFF000033333333333344444433FFFF333333777777
                  00003A444333333A22222437777F333337F3333700003A2243333333A2222437
                  F37F333333733337000033A224333334422224337337FFFFF7733337000033A2
                  22444442222224337F3377777333FF370000333A2222222222AA243337FF3333
                  33FF77F700003333AA222222AA33A3333377FFFFFF7733730000333333AAAAAA
                  3333333333337777773333330000333333333333333333333333333333333333
                  0000}
                LookAndFeel.SkinName = ''
                NumGlyphs = 2
              end
              object rgSC: TcxRadioGroup
                Left = 664
                Top = -1
                Anchors = [akTop, akRight]
                Properties.Columns = 2
                Properties.Items = <
                  item
                    Caption = #1055#1088#1072#1074#1080#1083#1100#1085#1099#1077' '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1103
                    Value = 0
                  end
                  item
                    Caption = #1059#1076#1072#1083#1077#1085#1085#1099#1077' '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1103
                    Value = 1
                  end>
                Properties.OnChange = rgSCPropertiesChange
                ItemIndex = 0
                TabOrder = 5
                Height = 32
                Width = 301
              end
              object bSCToExcel: TcxButton
                Tag = 12
                Left = 211
                Top = 3
                Width = 30
                Height = 27
                Hint = #1069#1082#1089#1087#1086#1088#1090' '#1074' Excel'
                ParentShowHint = False
                ShowHint = True
                TabOrder = 6
                TabStop = False
                OnClick = bSCToExcelClick
                Glyph.Data = {
                  F6000000424DF600000000000000760000002800000010000000100000000100
                  0400000000008000000000000000000000001000000000000000000000000000
                  8000008000000080800080000000800080008080000080808000C0C0C0000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333300003
                  30003333000088000EE033330FFF0880EE0033330F77708EE00333330FFFF0EE
                  800333000F770EE0880033090FF0EE0F0880000990F000FFF00009999907FF77
                  7F0309999990FFFFFF030999990FF7000003000990FFFF0FF03333090FFF770F
                  033333000FFFFF00333333330000000333333333333333333333}
                LookAndFeel.SkinName = ''
              end
              object cbSC: TcxCheckComboBox
                Left = 282
                Top = 5
                ParentFont = False
                Properties.EditValueFormat = cvfStatesString
                Properties.Items = <
                  item
                    Description = #1044#1077#1081#1089#1090#1074#1091#1102#1097#1077#1077
                  end
                  item
                    Description = #1054#1089#1085'. '#1091#1089#1083'.'
                    Tag = 1
                  end
                  item
                    Description = #1042#1089#1090#1091#1087#1080#1090'. '#1074#1079#1085#1086#1089
                    Tag = 2
                  end
                  item
                    Description = #1044#1086#1087'. '#1091#1089#1083'.'
                    Tag = 3
                  end
                  item
                    Description = #1056#1072#1079'. '#1091#1089#1083'.'
                    Tag = 4
                  end>
                Properties.ReadOnly = False
                Properties.OnEditValueChanged = cbSCPropertiesEditValueChanged
                EditValue = '10000'
                Style.Font.Charset = DEFAULT_CHARSET
                Style.Font.Color = clWindowText
                Style.Font.Height = -13
                Style.Font.Name = 'Tahoma'
                Style.Font.Style = []
                Style.IsFontAssigned = True
                TabOrder = 7
                Width = 343
              end
              object bbRetSummer: TcxButton
                Left = 634
                Top = 4
                Width = 27
                Height = 25
                Hint = #1051#1077#1090#1085#1103#1103' '#1082#1086#1084#1087#1077#1085#1089#1072#1094#1080#1103
                Anchors = [akTop, akRight]
                Caption = #1051#1050
                ParentShowHint = False
                ShowHint = True
                TabOrder = 8
                Visible = False
                OnClick = bbRetSummerClick
              end
              object bUndeleteSC: TcxButton
                Tag = 12
                Left = 246
                Top = 3
                Width = 30
                Height = 27
                Hint = #1042#1086#1089#1089#1090#1072#1085#1086#1074#1083#1077#1085#1080#1077' '#1044#1057
                ParentShowHint = False
                ShowHint = True
                TabOrder = 9
                TabStop = False
                Visible = False
                OnClick = bUndeleteSCClick
                Glyph.Data = {
                  F6000000424DF600000000000000760000002800000010000000100000000100
                  0400000000008000000000000000000000001000000000000000000000000000
                  80000080000000808000800000008000800080800000C0C0C000808080000000
                  FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
                  7777777777777777777777777777777777777777777777777777777777777777
                  7777777777777777477777444447777747777744447777777477774447777777
                  7477774474777777747777477744777747777777777744447777777777777777
                  7777777777777777777777777777777777777777777777777777}
                LookAndFeel.SkinName = ''
              end
            end
            object cxSplitter2: TcxSplitter
              Left = 1
              Top = 113
              Width = 998
              Height = 8
              HotZoneClassName = 'TcxMediaPlayer9Style'
              AlignSplitter = salTop
              Control = dbgAgr
            end
            object dbgSC: TcxGrid
              Left = 1
              Top = 158
              Width = 998
              Height = 105
              Align = alClient
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -13
              Font.Name = 'Tahoma'
              Font.Style = []
              ParentFont = False
              TabOrder = 4
              LookAndFeel.Kind = lfStandard
              object tvSC: TcxGridDBTableView
                NavigatorButtons.ConfirmDelete = False
                NavigatorButtons.First.Visible = True
                NavigatorButtons.PriorPage.Visible = True
                NavigatorButtons.Prior.Visible = True
                NavigatorButtons.Next.Visible = True
                NavigatorButtons.NextPage.Visible = True
                NavigatorButtons.Last.Visible = True
                NavigatorButtons.Insert.Visible = False
                NavigatorButtons.Append.Visible = False
                NavigatorButtons.Delete.Visible = False
                NavigatorButtons.Edit.Visible = False
                NavigatorButtons.Post.Visible = False
                NavigatorButtons.Cancel.Visible = False
                NavigatorButtons.Refresh.Visible = False
                NavigatorButtons.SaveBookmark.Visible = False
                NavigatorButtons.GotoBookmark.Visible = False
                NavigatorButtons.Filter.Visible = False
                OnCellDblClick = tvSCCellDblClick
                OnEditValueChanged = tvSCEditValueChanged
                OnFocusedRecordChanged = tvSCFocusedRecordChanged
                DataController.DataSource = dsSpecCond
                DataController.Summary.DefaultGroupSummaryItems = <>
                DataController.Summary.FooterSummaryItems = <
                  item
                    Format = '#,###0'
                    Kind = skSum
                    FieldName = 'DOLGNY_ZAPL'
                    Column = tvSCDOLGNY_ZAPL
                  end
                  item
                    Format = '#,###0'
                    Kind = skSum
                    FieldName = 'BALANCE'
                    Column = tvSCBALANCE
                  end
                  item
                    Format = '#,###0'
                    Kind = skSum
                    FieldName = 'SCAMOUNT'
                    Column = tvSCSCAMOUNT
                  end
                  item
                    Format = '#,###0'
                    Kind = skSum
                    FieldName = 'ZAPL_ALL'
                    Column = tvSCZAPL_ALL
                  end
                  item
                    Kind = skCount
                    FieldName = 'SCID'
                    Column = tvSCSCID
                  end>
                DataController.Summary.SummaryGroups = <>
                OptionsBehavior.CellHints = True
                OptionsBehavior.ImmediateEditor = False
                OptionsBehavior.IncSearch = True
                OptionsCustomize.ColumnFiltering = False
                OptionsData.CancelOnExit = False
                OptionsData.Deleting = False
                OptionsData.DeletingConfirmation = False
                OptionsData.Inserting = False
                OptionsView.CellEndEllipsis = True
                OptionsView.NavigatorOffset = 10
                OptionsView.CellTextMaxLineCount = 1
                OptionsView.ColumnAutoWidth = True
                OptionsView.Footer = True
                OptionsView.GroupByBox = False
                OptionsView.Indicator = True
                OptionsView.ShowColumnFilterButtons = sfbAlways
                Preview.Visible = True
                Styles.IncSearch = DMInv.cxKrasniyText
                Styles.Selection = DMInv.cxJoltiyFon
                Styles.Header = DMInv.cxSiniyText
                object tvSCSCID: TcxGridDBColumn
                  Caption = #1057#1082#1074#1086#1079#1085'. '#1085#1086#1084#1077#1088
                  DataBinding.FieldName = 'SCID'
                  Options.Editing = False
                  Width = 26
                end
                object tvSCAGID: TcxGridDBColumn
                  Caption = #8470' '#1076#1086#1075'.'
                  DataBinding.FieldName = 'AGID'
                  PropertiesClassName = 'TcxLookupComboBoxProperties'
                  Properties.DropDownListStyle = lsFixedList
                  Properties.KeyFieldNames = 'AGID'
                  Properties.ListColumns = <
                    item
                      FieldName = 'NAME'
                    end>
                  Properties.ListOptions.ShowHeader = False
                  Properties.ListSource = dsSCagrid
                  Properties.OnCloseUp = tvSCAGIDPropertiesCloseUp
                  Options.Editing = False
                  Options.Sorting = False
                  Width = 63
                end
                object tvSCSCNUM_N: TcxGridDBColumn
                  Caption = #1053#1086#1084#1077#1088
                  DataBinding.FieldName = 'SCNUM_N'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSTNAME: TcxGridDBColumn
                  DataBinding.FieldName = 'STNAME'
                  Options.Editing = False
                  Width = 28
                end
                object tvSCSCDATEBEGIN: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1074#1089#1090'. '#1074' '#1089#1080#1083#1091
                  DataBinding.FieldName = 'SCDATEBEGIN'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSCDATE: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1087#1086#1076#1087'.'
                  DataBinding.FieldName = 'SCDATE'
                  Options.Editing = False
                  Width = 28
                end
                object tvSCSCDATEEND: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1079#1072#1074#1077#1088#1096'.'
                  DataBinding.FieldName = 'SCDATEEND'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSTDESCR: TcxGridDBColumn
                  Caption = #1054#1087#1080#1089#1072#1085#1080#1077
                  DataBinding.FieldName = 'STDESCR'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSCOUNT: TcxGridDBColumn
                  Caption = #1050#1086#1083#1080#1095'.'
                  DataBinding.FieldName = 'SCOUNT'
                  Options.Editing = False
                  Width = 29
                end
                object tvSCSTTARIF: TcxGridDBColumn
                  Caption = #1058#1072#1088#1080#1092
                  DataBinding.FieldName = 'STTARIF'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSCTARIFWITHDISCOUNT: TcxGridDBColumn
                  Caption = #1058#1072#1088#1080#1092' '#1089#1086' '#1089#1082#1080#1076#1082'.'
                  DataBinding.FieldName = 'SCTARIFWITHDISCOUNT'
                  Options.Editing = False
                  Width = 28
                end
                object tvSCSKIDKA: TcxGridDBColumn
                  Caption = #1057#1082#1080#1076#1082#1072
                  DataBinding.FieldName = 'SKIDKA'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSCAMOUNT: TcxGridDBColumn
                  Caption = #1054#1073#1097#1072#1103' '#1089#1091#1084#1084#1072
                  DataBinding.FieldName = 'SCAMOUNT'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCSTIMEBEGIN: TcxGridDBColumn
                  Caption = #1042#1088#1077#1084#1103' '#1085#1072#1095'.'
                  DataBinding.FieldName = 'STIMEBEGIN'
                  Options.Editing = False
                  Width = 28
                end
                object tvSCSTIMEEND: TcxGridDBColumn
                  Caption = #1042#1088#1077#1084#1103' '#1086#1082#1086#1085#1095'.'
                  DataBinding.FieldName = 'STIMEEND'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCISSCAN: TcxGridDBColumn
                  Caption = #1050#1086#1087#1080#1103
                  DataBinding.FieldName = 'ISSCAN'
                  PropertiesClassName = 'TcxCheckBoxProperties'
                  Properties.ReadOnly = True
                  Properties.ValueChecked = 1
                  Properties.ValueUnchecked = 0
                  Options.Editing = False
                  Width = 28
                end
                object tvSCTIP: TcxGridDBColumn
                  Caption = #1058#1080#1087
                  DataBinding.FieldName = 'TIP'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCPERIOD: TcxGridDBColumn
                  Caption = #1055#1077#1088#1080#1086#1076
                  DataBinding.FieldName = 'PERIOD'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCDOLGNY_ZAPL: TcxGridDBColumn
                  Caption = #1057#1091#1084#1084#1072' '#1087#1086' '#1075#1088#1072#1092#1080#1082#1091
                  DataBinding.FieldName = 'DOLGNY_ZAPL'
                  Options.Editing = False
                  Width = 29
                end
                object tvSCBALANCE: TcxGridDBColumn
                  Caption = #1044#1086#1083#1075' '#1087#1086' '#1075#1088#1072#1092#1080#1082#1091
                  DataBinding.FieldName = 'BALANCE'
                  Options.Editing = False
                  Width = 34
                end
                object tvSCSTTIMEENTER: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076'.'
                  DataBinding.FieldName = 'SCTIMEENTER'
                  Options.Editing = False
                  Width = 27
                end
                object tvSCAUTOR: TcxGridDBColumn
                  Caption = #1040#1074#1090#1086#1088
                  DataBinding.FieldName = 'AUTOR'
                  Options.Editing = False
                  Width = 28
                end
                object tvSCSCDATERASTORJ: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1088#1072#1089#1090#1086#1088#1078'.'
                  DataBinding.FieldName = 'SCDATERASTORJ'
                  Options.Editing = False
                  Width = 47
                end
                object tvSCZAPL_ALL: TcxGridDBColumn
                  Caption = #1042#1089#1077#1075#1086' '#1086#1087#1083'.'
                  DataBinding.FieldName = 'ZAPL_ALL'
                  Options.Editing = False
                  Width = 40
                end
                object tvSCEDIT_USER: TcxGridDBColumn
                  Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                  DataBinding.FieldName = 'EDIT_USER'
                  Options.Editing = False
                  Width = 42
                end
                object tvSCSNOTE: TcxGridDBColumn
                  Caption = #1050#1086#1084#1084#1077#1085#1090'.'
                  DataBinding.FieldName = 'SNOTE'
                  Width = 48
                end
                object tvSCSCTIMEEDIT: TcxGridDBColumn
                  Caption = #1044#1072#1090#1072' '#1088#1077#1076#1072#1082#1090#1080#1088'. '
                  DataBinding.FieldName = 'TIME_EDIT'
                  Options.Editing = False
                  Width = 89
                end
                object tvSCSCUSERAPPROVED: TcxGridDBColumn
                  Caption = #1054#1076#1086#1073#1088#1080#1083
                  DataBinding.FieldName = 'SCUSERAPPROVED'
                  Width = 70
                end
              end
              object cxGridLevel4: TcxGridLevel
                GridView = tvSC
              end
            end
          end
          object cxSplitter5: TcxSplitter
            Left = 1001
            Top = 1
            Width = 8
            Height = 264
            HotZoneClassName = 'TcxMediaPlayer9Style'
            Control = Panel17
          end
          object pcAgr: TcxPageControl
            Left = 1009
            Top = 1
            Width = 298
            Height = 264
            ActivePage = tsExtraService
            Align = alClient
            Constraints.MinWidth = 20
            LookAndFeel.SkinName = 'Office2007Silver'
            TabOrder = 2
            OnPageChanging = pcAgrPageChanging
            ClientRectBottom = 258
            ClientRectLeft = 3
            ClientRectRight = 292
            ClientRectTop = 26
            object tsPlat: TcxTabSheet
              Caption = #1055#1083#1072#1090#1077#1078#1080
              ImageIndex = 0
              TabVisible = False
              object cxGrid7: TcxGrid
                Left = 0
                Top = 0
                Width = 208
                Height = 232
                Align = alClient
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -13
                Font.Name = 'Tahoma'
                Font.Style = []
                ParentFont = False
                TabOrder = 0
                LookAndFeel.Kind = lfStandard
                LookAndFeel.SkinName = 'Office2007Silver'
                object tvSCCommon: TcxGridDBTableView
                  NavigatorButtons.ConfirmDelete = False
                  OnCellClick = tvPlatCellClick
                  OnEditValueChanged = tvPlatEditValueChanged
                  DataController.DataSource = dsSCCommon
                  DataController.Summary.DefaultGroupSummaryItems = <>
                  DataController.Summary.FooterSummaryItems = <
                    item
                      Format = '#,###0'
                      Kind = skSum
                      FieldName = 'CAMOUNT'
                      Column = tvSCCommonCAMOUNT
                    end>
                  DataController.Summary.SummaryGroups = <>
                  OptionsBehavior.CellHints = True
                  OptionsCustomize.ColumnFiltering = False
                  OptionsData.CancelOnExit = False
                  OptionsData.Deleting = False
                  OptionsData.DeletingConfirmation = False
                  OptionsData.Editing = False
                  OptionsData.Inserting = False
                  OptionsView.CellEndEllipsis = True
                  OptionsView.CellAutoHeight = True
                  OptionsView.CellTextMaxLineCount = 1
                  OptionsView.ColumnAutoWidth = True
                  OptionsView.Footer = True
                  OptionsView.GroupByBox = False
                  OptionsView.HeaderEndEllipsis = True
                  Preview.Visible = True
                  Styles.Header = DMInv.cxSiniyText
                  object tvSCCommonCSDATE: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072
                    DataBinding.FieldName = 'CSDATE'
                    Width = 64
                  end
                  object tvSCCommonCAMOUNT: TcxGridDBColumn
                    Caption = #1057#1091#1084#1084#1072
                    DataBinding.FieldName = 'CAMOUNT'
                    Width = 61
                  end
                  object tvSCCommonCSFORM: TcxGridDBColumn
                    Caption = #1053#1072#1083'.'
                    DataBinding.FieldName = 'CSFORM'
                    PropertiesClassName = 'TcxCheckBoxProperties'
                    Properties.ValueChecked = 0
                    Properties.ValueUnchecked = 1
                    Width = 56
                  end
                  object tvSCCommonCSNOTE: TcxGridDBColumn
                    Caption = #1050#1086#1084#1084#1077#1085#1090'.'
                    DataBinding.FieldName = 'CSNOTE'
                    Width = 87
                  end
                end
                object cxGridLevel9: TcxGridLevel
                  GridView = tvSCCommon
                end
              end
            end
            object tsPodrazd: TcxTabSheet
              Caption = #1055#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1103
              ImageIndex = 1
              object dbgPodrazd: TcxGrid
                Left = 0
                Top = 28
                Width = 289
                Height = 204
                Align = alClient
                TabOrder = 0
                LookAndFeel.Kind = lfStandard
                LookAndFeel.SkinName = 'Office2007Silver'
                object tvPodrazd: TcxGridDBTableView
                  NavigatorButtons.ConfirmDelete = False
                  NavigatorButtons.First.Visible = True
                  NavigatorButtons.PriorPage.Visible = True
                  NavigatorButtons.Prior.Visible = True
                  NavigatorButtons.Next.Visible = True
                  NavigatorButtons.NextPage.Visible = True
                  NavigatorButtons.Last.Visible = True
                  NavigatorButtons.Insert.Visible = False
                  NavigatorButtons.Append.Visible = False
                  NavigatorButtons.Delete.Visible = False
                  NavigatorButtons.Edit.Visible = False
                  NavigatorButtons.Post.Visible = False
                  NavigatorButtons.Cancel.Visible = False
                  NavigatorButtons.Refresh.Visible = False
                  NavigatorButtons.SaveBookmark.Visible = False
                  NavigatorButtons.GotoBookmark.Visible = False
                  NavigatorButtons.Filter.Visible = False
                  OnEditValueChanged = tvOsnPodrEditValueChanged
                  DataController.DataSource = dsSCPodrazd
                  DataController.Summary.DefaultGroupSummaryItems = <>
                  DataController.Summary.FooterSummaryItems = <>
                  DataController.Summary.SummaryGroups = <>
                  OptionsBehavior.CellHints = True
                  OptionsBehavior.IncSearch = True
                  OptionsCustomize.ColumnFiltering = False
                  OptionsCustomize.ColumnGrouping = False
                  OptionsData.CancelOnExit = False
                  OptionsData.Deleting = False
                  OptionsData.DeletingConfirmation = False
                  OptionsData.Editing = False
                  OptionsData.Inserting = False
                  OptionsView.NavigatorOffset = 10
                  OptionsView.CellAutoHeight = True
                  OptionsView.CellTextMaxLineCount = 1
                  OptionsView.ColumnAutoWidth = True
                  OptionsView.GroupByBox = False
                  OptionsView.Indicator = True
                  OptionsView.ShowColumnFilterButtons = sfbAlways
                  Preview.Visible = True
                  Styles.Content = DMInv.cxData
                  Styles.IncSearch = DMInv.cxKrasniyText
                  Styles.Selection = DMInv.cxJoltiyFon
                  Styles.Header = DMInv.cxSiniyText
                  object tvPodrazdSDNAME: TcxGridDBColumn
                    Caption = #1055#1086#1076#1088#1072#1079#1076'.'
                    DataBinding.FieldName = 'SDNAME'
                    Width = 54
                  end
                  object tvPodrazdDPDATEIN: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072' '#1079#1072#1095#1080#1089#1083'.'
                    DataBinding.FieldName = 'DPDATEIN'
                    Width = 73
                  end
                  object tvPodrazdINNOTE: TcxGridDBColumn
                    Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081' '#1082' '#1079#1072#1095#1080#1089#1083'.'
                    DataBinding.FieldName = 'INNOTE'
                    Width = 123
                  end
                  object tvPodrazdDPDATEOUT: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072' '#1080#1089#1082#1083#1102#1095'.'
                    DataBinding.FieldName = 'DPDATEOUT'
                    Width = 76
                  end
                  object tvPodrazdOUTNOTE: TcxGridDBColumn
                    Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1082' '#1080#1089#1082#1083#1102#1095'.'
                    DataBinding.FieldName = 'OUTNOTE'
                    Width = 107
                  end
                  object tvPodrazdDPUSERENTER: TcxGridDBColumn
                    Caption = #1040#1074#1090#1086#1088
                    DataBinding.FieldName = 'DPUSERENTER'
                    Width = 36
                  end
                  object tvPodrazdDPTIMEENTER: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076'.'
                    DataBinding.FieldName = 'DPTIMEENTER'
                    Width = 62
                  end
                  object tvPodrazdDPUSEREDIT: TcxGridDBColumn
                    Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                    DataBinding.FieldName = 'DPUSEREDIT'
                    Width = 54
                  end
                  object tvPodrazdDPTIMEEDIT: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072' '#1088#1077#1076#1072#1082#1090#1080#1088'.'
                    DataBinding.FieldName = 'DPTIMEEDIT'
                    Width = 87
                  end
                end
                object cxGridLevel17: TcxGridLevel
                  GridView = tvPodrazd
                end
              end
              object dxBarDockControl1: TdxBarDockControl
                Left = 0
                Top = 0
                Width = 289
                Height = 28
                Align = dalTop
                BarManager = dxBarManager1
                SunkenBorder = True
                UseOwnSunkenBorder = True
              end
            end
            object tsExtraService: TcxTabSheet
              Caption = #1069#1082#1089#1090#1088#1072#1091#1089#1083#1091#1075#1080
              ImageIndex = 2
              object gdExtraService: TcxGrid
                Left = 0
                Top = 26
                Width = 289
                Height = 206
                Align = alClient
                TabOrder = 0
                LookAndFeel.Kind = lfFlat
                LookAndFeel.SkinName = 'Office2007Silver'
                object tvExtraService: TcxGridDBTableView
                  NavigatorButtons.ConfirmDelete = False
                  DataController.DataSource = dsExtraService
                  DataController.KeyFieldNames = 'ID'
                  DataController.Summary.DefaultGroupSummaryItems = <>
                  DataController.Summary.FooterSummaryItems = <>
                  DataController.Summary.SummaryGroups = <>
                  OptionsBehavior.CellHints = True
                  OptionsBehavior.IncSearch = True
                  OptionsCustomize.ColumnsQuickCustomization = True
                  OptionsData.Deleting = False
                  OptionsData.Editing = False
                  OptionsData.Inserting = False
                  OptionsSelection.HideFocusRectOnExit = False
                  OptionsView.ColumnAutoWidth = True
                  OptionsView.GroupByBox = False
                  Styles.Content = DMInv.cxData
                  Styles.IncSearch = DMInv.cxKrasniyText
                  Styles.Selection = DMInv.cxJoltiyFon
                  Styles.Header = DMInv.cxSiniyText
                  object tvExtraService_ID: TcxGridDBColumn
                    DataBinding.FieldName = 'ID'
                    Visible = False
                    VisibleForCustomization = False
                  end
                  object tvExtraService_SCID: TcxGridDBColumn
                    DataBinding.FieldName = 'SCID'
                    Visible = False
                    VisibleForCustomization = False
                  end
                  object tvExtraService_KOL: TcxGridDBColumn
                    Caption = #1054#1089#1090#1072#1074#1096#1077#1077#1089#1103' '#1082#1086#1083'-'#1074#1086
                    DataBinding.FieldName = 'KOL'
                    Width = 84
                  end
                  object tvExtraService_COMMON_COUNT: TcxGridDBColumn
                    Caption = #1054#1073#1097#1077#1077' '#1082#1086#1083'-'#1074#1086
                    DataBinding.FieldName = 'COMMON_COUNT'
                    Width = 74
                  end
                  object tvExtraService_TIME_ENTER: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076#1072#1085#1080#1103
                    DataBinding.FieldName = 'TIME_ENTER'
                    Width = 132
                  end
                  object tvExtraService_USER_ENTER: TcxGridDBColumn
                    Caption = #1040#1074#1090#1086#1088
                    DataBinding.FieldName = 'USER_ENTER'
                    Width = 131
                  end
                  object tvExtraService_TIME_EDIT: TcxGridDBColumn
                    Caption = #1044#1072#1090#1072' '#1088#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1085#1080#1103
                    DataBinding.FieldName = 'TIME_EDIT'
                    Visible = False
                    Width = 132
                  end
                  object tvExtraService_USER_EDIT: TcxGridDBColumn
                    Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                    DataBinding.FieldName = 'USER_EDIT'
                    Visible = False
                    Width = 131
                  end
                end
                object lvExtraService: TcxGridLevel
                  GridView = tvExtraService
                end
              end
              object bdcExtraService: TdxBarDockControl
                Left = 0
                Top = 0
                Width = 289
                Height = 26
                Align = dalTop
                BarManager = dxBarManager1
              end
            end
          end
        end
      end
      object tsVizit: TcxTabSheet
        Caption = #1055#1086#1089#1077#1097#1077#1085#1080#1103
        ImageIndex = 1
        OnHide = tsVizitHide
        OnShow = tsVizitShow
        object Panel_vizit: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_vizit'
          TabOrder = 0
          object Label28: TLabel
            Left = 0
            Top = 0
            Width = 1308
            Height = 19
            Align = alTop
            Caption = #1055#1086#1089#1077#1097#1077#1085#1080#1103
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clGray
            Font.Height = -16
            Font.Name = 'Tahoma'
            Font.Style = [fsBold]
            ParentFont = False
          end
          object ToolBar4: TToolBar
            Left = 0
            Top = 19
            Width = 1308
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            object bVizittoExcel: TToolButton
              Left = 0
              Top = 2
              Hint = #1069#1082#1089#1087#1086#1088#1090' '#1074' Excel'
              ImageIndex = 16
              ParentShowHint = False
              ShowHint = True
              OnClick = bVizittoExcelClick
            end
            object ToolButton1: TToolButton
              Left = 23
              Top = 2
              Caption = 'ToolButton1'
              ImageIndex = 34
              OnClick = ToolButton1Click
            end
          end
          object dbgVizit: TcxGrid
            Left = 0
            Top = 51
            Width = 1308
            Height = 215
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 1
            TabStop = False
            LookAndFeel.Kind = lfStandard
            object tvVizit: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsVizit
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.CellEndEllipsis = True
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.HeaderEndEllipsis = True
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              object tvVizitPVTIME_IN: TcxGridDBColumn
                Caption = #1042#1093#1086#1076
                DataBinding.FieldName = 'PVTIME_IN'
                Width = 21
              end
              object tvVizitPVTIME_OUT: TcxGridDBColumn
                Caption = #1042#1099#1093#1086#1076
                DataBinding.FieldName = 'PVTIME_OUT'
                Width = 25
              end
              object tvVizitH: TcxGridDBColumn
                Caption = #1050#1086#1083'. '#1095#1072#1089#1086#1074
                DataBinding.FieldName = 'H'
                Width = 42
              end
              object tvVizitPP_IN: TcxGridDBColumn
                Caption = #1040#1074#1090#1086#1088' '#1074#1093#1086#1076#1072
                DataBinding.FieldName = 'PP_IN'
                Width = 46
              end
              object tvVizitPP_OUT: TcxGridDBColumn
                Caption = #1040#1074#1090#1086#1088' '#1074#1099#1093#1086#1076#1072
                DataBinding.FieldName = 'PP_OUT'
                Width = 52
              end
              object tvVizitSCAN_IN: TcxGridDBColumn
                Caption = #1058#1080#1087' '#1074#1093#1086#1076#1072
                DataBinding.FieldName = 'SCAN_IN'
                Width = 39
              end
              object tvVizitSCAN_OUT: TcxGridDBColumn
                Caption = #1058#1080#1087' '#1074#1099#1093#1086#1076#1072
                DataBinding.FieldName = 'SCAN_OUT'
                Width = 44
              end
              object tvVizitPVPRIZNAK_IN: TcxGridDBColumn
                Caption = #1055#1088#1080#1079#1085#1072#1082' '#1074#1093'.'
                DataBinding.FieldName = 'PVPRIZNAK_IN'
                Width = 47
              end
              object tvVizitPVPRIZNAK_OUT: TcxGridDBColumn
                Caption = #1055#1088#1080#1079#1085#1072#1082' '#1074#1099#1093'.'
                DataBinding.FieldName = 'PVPRIZNAK_OUT'
                Width = 51
              end
              object tvVizitUSER_EXTRA: TcxGridDBColumn
                Caption = #1056#1072#1079#1088#1077#1096#1077#1085#1080#1077' '#1085#1072' '#1074#1093#1086#1076' '#1086#1090
                DataBinding.FieldName = 'USER_EXTRA'
                Width = 84
              end
              object tvVizitPRICHINA: TcxGridDBColumn
                Caption = #1055#1088#1080#1095#1080#1085#1072' '#1079#1072#1087#1088#1077#1090#1072
                DataBinding.FieldName = 'PRICHINA'
                Width = 67
              end
              object tvVizitNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081' '#1082' '#1088#1072#1079#1088#1077#1096#1077#1085#1080#1102
                DataBinding.FieldName = 'NOTE'
                Width = 152
              end
            end
            object cxGridLevel3: TcxGridLevel
              GridView = tvVizit
            end
          end
        end
      end
      object tsJurDoc: TcxTabSheet
        Caption = #1070#1088'. '#1076#1086#1082#1091#1084#1077#1085#1090#1099
        ImageIndex = 2
        object Panel_JurDoc: TPanel
          Left = 0
          Top = 0
          Width = 1202
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_JurDoc'
          TabOrder = 0
          object Label27: TLabel
            Left = 0
            Top = 0
            Width = 132
            Height = 19
            Align = alTop
            Caption = #1070#1088'. '#1076#1086#1082#1091#1084#1077#1085#1090#1099
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clGray
            Font.Height = -16
            Font.Name = 'Tahoma'
            Font.Style = [fsBold]
            ParentFont = False
          end
          object cxGrid2: TcxGrid
            Left = 0
            Top = 19
            Width = 1227
            Height = 247
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 0
            TabStop = False
            LookAndFeel.Kind = lfStandard
            object cxGridDBTableView2: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsDocuments
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.Deleting = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              object cxGridDBTableView2DDATE: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1074#1099#1076#1072#1095#1080
                DataBinding.FieldName = 'DDATE'
                Width = 191
              end
              object cxGridDBTableView2DTIMEENTER: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1079#1072#1074#1077#1076#1077#1085#1080#1103' '
                DataBinding.FieldName = 'DTIMEENTER'
                Width = 290
              end
              object cxGridDBTableView2SDNAME: TcxGridDBColumn
                Caption = #1058#1080#1087
                DataBinding.FieldName = 'SDNAME'
                Width = 550
              end
            end
            object cxGridLevel2: TcxGridLevel
              GridView = cxGridDBTableView2
            end
          end
        end
      end
      object tsPayments: TcxTabSheet
        Caption = #1055#1083#1072#1090#1077#1078#1080
        ImageIndex = 3
        OnHide = tsPaymentsHide
        OnShow = tsPaymentsShow
        object Panel_payments: TPanel
          Left = 0
          Top = 0
          Width = 1316
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_payments'
          TabOrder = 0
          object Panel14: TPanel
            Left = 0
            Top = 0
            Width = 1316
            Height = 34
            Align = alTop
            TabOrder = 0
            object rgPlat: TcxRadioGroup
              Left = 249
              Top = -3
              Properties.Columns = 2
              Properties.Items = <
                item
                  Caption = #1055#1088#1072#1074#1080#1083#1100#1085#1099#1077' '#1087#1083#1072#1090#1077#1078#1080
                  Value = 0
                end
                item
                  Caption = #1059#1076#1072#1083#1077#1085#1085#1099#1077' '#1087#1083#1072#1090#1077#1078#1080
                  Value = 1
                end>
              Properties.OnChange = rgPlatPropertiesChange
              ItemIndex = 0
              TabOrder = 0
              Height = 33
              Width = 314
            end
            object bAddCommon: TcxButton
              Tag = 12
              Left = 6
              Top = 3
              Width = 31
              Height = 27
              Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1087#1083#1072#1090#1077#1078
              ParentShowHint = False
              ShowHint = True
              TabOrder = 1
              TabStop = False
              OnClick = bAddCommonClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                04000000000000010000CE0E0000D80E00001000000000000000000000000000
                80000080000000808000800000008000800080800000C0C0C000808080000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                3333333333387F3333333333333333333333333333387F333333333333344333
                3333333333387F3333333333333443333333333333387F333333333333344333
                3333333333387F3333333333333443333333333333387F333333333333344333
                3333387FFFFFFFFFFFFF3344444444444433387777777F777777334444444444
                4433388888887F8888883333333443333333333333387F333333333333344333
                3333333333387F3333333333333443333333333333387F333333333333344333
                3333333333387F33333333333334433333333333333877333333333333333333
                3333333333388833333333333333333333333333333333333333}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
            object bDelCommon: TcxButton
              Tag = 12
              Left = 39
              Top = 3
              Width = 30
              Height = 27
              Hint = #1059#1076#1072#1083#1080#1090#1100' '#1087#1083#1072#1090#1077#1078
              ParentShowHint = False
              ShowHint = True
              TabOrder = 2
              TabStop = False
              OnClick = bDelCommonClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                0400000000000001000000000000000000001000000000000000000000000000
                8000008000000080800080000000800080008080000080808000C0C0C0000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                3333333333333333333333333333333333333333333333333333333333333333
                3333333333333333333333337333333333333333F33333333333333313333333
                333333337F33333333333333113333713333333377F33377F333333371733717
                3333333377F3377F333333333117311333333333377F377F3333333337111133
                33333333337777F33333333337111333333333333F777F333333333371111733
                3333333337777F3333333333117311733333333377F377F33333333333333117
                333333333333377F33333333333333117333333333333377F333333333333333
                3333333333333333333333333333333333333333333333333333}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
            object bPrintInDoc: TcxButton
              Tag = 12
              Left = 72
              Top = 3
              Width = 30
              Height = 27
              Hint = #1055#1077#1095#1072#1090#1100' '#1087#1088#1080#1093#1086#1076#1085#1086#1075#1086' '#1082#1072#1089#1089#1086#1074#1086#1075#1086' '#1086#1088#1076#1077#1088#1072
              ParentShowHint = False
              ShowHint = True
              TabOrder = 3
              TabStop = False
              OnClick = bPrintInDocClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                04000000000000010000130B0000130B00001000000000000000000000000000
                800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00300000000000
                00033FFFFFFFFFFFFFFF0888888888888880777777777777777F088888888888
                8880777777777777777F0000000000000000FFFFFFFFFFFFFFFF0F8F8F8F8F8F
                8F80777777777777777F08F8F8F8F8F8F9F0777777777777777F0F8F8F8F8F8F
                8F807777777777777F7F0000000000000000777777777777777F3330FFFFFFFF
                03333337F3FFFF3F7F333330F0000F0F03333337F77773737F333330FFFFFFFF
                03333337F3FF3FFF7F333330F00F000003333337F773777773333330FFFF0FF0
                33333337F3FF7F3733333330F08F0F0333333337F7737F7333333330FFFF0033
                33333337FFFF7733333333300000033333333337777773333333}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
            object bDolg: TcxButton
              Left = 723
              Top = 4
              Width = 155
              Height = 25
              Caption = #1055#1086#1089#1090#1072#1074#1080#1090#1100' '#1085#1072' '#1082#1086#1085#1090#1088#1086#1083#1100
              TabOrder = 5
              Visible = False
              OnClick = bDolgClick
            end
            object bPaymentCopy: TcxButton
              Left = 886
              Top = 4
              Width = 35
              Height = 25
              Caption = 'PC'
              TabOrder = 6
              Visible = False
              OnClick = bPaymentCopyClick
            end
            object bEditCS: TcxButton
              Tag = 12
              Left = 139
              Top = 3
              Width = 30
              Height = 27
              Hint = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1085#1080#1077' '#1087#1083#1072#1090#1077#1078#1072
              ParentShowHint = False
              ShowHint = True
              TabOrder = 4
              TabStop = False
              OnClick = bEditCSClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                04000000000000010000120B0000120B00001000000000000000000000000000
                800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333000000
                000033333377777777773333330FFFFFFFF03FF3FF7FF33F3FF700300000FF0F
                00F077F777773F737737E00BFBFB0FFFFFF07773333F7F3333F7E0BFBF000FFF
                F0F077F3337773F3F737E0FBFBFBF0F00FF077F3333FF7F77F37E0BFBF00000B
                0FF077F3337777737337E0FBFBFBFBF0FFF077F33FFFFFF73337E0BF0000000F
                FFF077FF777777733FF7000BFB00B0FF00F07773FF77373377373330000B0FFF
                FFF03337777373333FF7333330B0FFFF00003333373733FF777733330B0FF00F
                0FF03333737F37737F373330B00FFFFF0F033337F77F33337F733309030FFFFF
                00333377737FFFFF773333303300000003333337337777777333}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
            object bBNInfo: TcxButton
              Tag = 12
              Left = 105
              Top = 3
              Width = 30
              Height = 27
              Hint = #1044#1086#1087'. '#1080#1085#1092#1086#1088#1084'. '#1087#1086' '#1087#1083#1072#1090#1077#1078#1091
              ParentShowHint = False
              ShowHint = True
              TabOrder = 7
              TabStop = False
              Visible = False
              OnClick = bBNInfoClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                0400000000000001000000000000000000001000000000000000000000000000
                80000080000000808000800000008000800080800000C0C0C000808080000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
                7777777777777777777777777777777777777777777FFFF77777777777CCCC77
                77777777778888F7777777777CCCCC777777777778888877777777777CCC7777
                777777777888F7777777777777CC7777777777777788F7777777777777CCC777
                7777777777888F77777777777CCCC7777777777778888F77777777777CCCCC77
                77777777788888F7777777777777CC7777777777777788F77777777777777777
                77777777777FFF7777777777777CC7777777777777788F7777777777777CC777
                7777777777788F7777777777777CC77777777777777887777777777777777777
                7777777777777777777777777777777777777777777777777777}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
            object bSCUndelete: TcxButton
              Tag = 12
              Left = 172
              Top = 3
              Width = 30
              Height = 27
              Hint = #1042#1086#1089#1089#1090#1072#1085#1086#1074#1083#1077#1085#1080#1077' '#1087#1083#1072#1090#1077#1078#1072
              ParentShowHint = False
              ShowHint = True
              TabOrder = 8
              TabStop = False
              Visible = False
              OnClick = bSCUndeleteClick
              Glyph.Data = {
                F6000000424DF600000000000000760000002800000010000000100000000100
                0400000000008000000000000000000000001000000000000000000000000000
                80000080000000808000800000008000800080800000C0C0C000808080000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777
                7777777777777777777777777777777777777777777777777777777777777777
                7777777777777777477777444447777747777744447777777477774447777777
                7477774474777777747777477744777747777777777744447777777777777777
                7777777777777777777777777777777777777777777777777777}
              LookAndFeel.SkinName = ''
            end
            object bCommonToExcel: TcxButton
              Tag = 12
              Left = 206
              Top = 3
              Width = 30
              Height = 27
              Hint = #1069#1082#1089#1087#1086#1088#1090' '#1074' Excel'
              ParentShowHint = False
              ShowHint = True
              TabOrder = 9
              TabStop = False
              OnClick = bCommonToExcelClick
              Glyph.Data = {
                F6000000424DF600000000000000760000002800000010000000100000000100
                0400000000008000000000000000000000001000000000000000000000000000
                8000008000000080800080000000800080008080000080808000C0C0C0000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333300003
                30003333000088000EE033330FFF0880EE0033330F77708EE00333330FFFF0EE
                800333000F770EE0880033090FF0EE0F0880000990F000FFF00009999907FF77
                7F0309999990FFFFFF030999990FF7000003000990FFFF0FF03333090FFF770F
                033333000FFFFF00333333330000000333333333333333333333}
              LookAndFeel.SkinName = ''
            end
            object bShowcolPay: TcxButton
              Tag = 12
              Left = 568
              Top = 5
              Width = 28
              Height = 23
              Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
              ParentShowHint = False
              ShowHint = True
              TabOrder = 10
              TabStop = False
              OnClick = bShowcolPayClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                04000000000000010000120B0000120B00001000000000000000000000000000
                80000080000000808000800000008000800080800000C0C0C000808080000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
                FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
                FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
                FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
                FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
                FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
                C77087F7888888888FF809090000000000008787888888888888399333333333
                3333377333333333333333333333333333333333333333333333}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
          end
          object dbgPaymants_Agr: TcxGrid
            Left = 813
            Top = 34
            Width = 495
            Height = 232
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -13
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object tvPaymants_Agr: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              OnCellDblClick = tvPaymants_AgrCellDblClick
              DataController.DataSource = dsPaymants_Agr
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <
                item
                  Format = '#,###0'
                  Kind = skSum
                  FieldName = 'PAAMOUNT'
                  Column = tvPaymants_AgrPAAMOUNT
                end
                item
                  Format = '#,###0'
                  Kind = skSum
                  FieldName = 'PAAMOUNTBALANCE'
                  Column = tvPaymants_AgrPAAMOUNTBALANCE
                end
                item
                  Format = '#,###0'
                  Kind = skSum
                  FieldName = 'PABANKPERCENTS'
                  Column = tvPaymants_AgrPABANKPERCENTS
                end>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.CellEndEllipsis = True
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.Footer = True
              OptionsView.GroupByBox = False
              OptionsView.HeaderEndEllipsis = True
              Preview.Visible = True
              Styles.Header = DMInv.cxSiniyText
              object tvPaymants_AgrPAID: TcxGridDBColumn
                Caption = #1053#1086#1084#1077#1088
                DataBinding.FieldName = 'PAID'
                Width = 33
              end
              object tvPaymants_AgrPADATE: TcxGridDBColumn
                Caption = #1044#1072#1090#1072
                DataBinding.FieldName = 'PADATE'
                Width = 27
              end
              object tvPaymants_AgrAGRID: TcxGridDBColumn
                Caption = #8470' '#1076#1086#1075'.'
                DataBinding.FieldName = 'AGRID'
                Width = 38
              end
              object tvPaymants_AgrP_RECIPIENT: TcxGridDBColumn
                Caption = #1055#1086#1083#1091#1095'. '#1091#1089#1083#1091#1075
                DataBinding.FieldName = 'P_RECIPIENT'
                Width = 63
              end
              object tvPaymants_AgrPLAT: TcxGridDBColumn
                Caption = #1055#1083#1072#1090#1077#1083#1100#1097#1080#1082
                DataBinding.FieldName = 'PLAT'
                Width = 60
              end
              object tvPaymants_AgrTIP: TcxGridDBColumn
                Caption = #1058#1080#1087
                DataBinding.FieldName = 'TIP'
                Width = 21
              end
              object tvPaymants_AgrPAAMOUNT: TcxGridDBColumn
                Caption = #1057#1091#1084#1084#1072' '#1087#1083#1072#1090'.'
                DataBinding.FieldName = 'PAAMOUNT'
                Width = 60
              end
              object tvPaymants_AgrPABANKPERCENTS: TcxGridDBColumn
                Caption = #1041#1072#1085#1082'. '#1087#1088#1086#1094'.'
                DataBinding.FieldName = 'PABANKPERCENTS'
                Width = 56
              end
              object tvPaymants_AgrPAAMOUNTBALANCE: TcxGridDBColumn
                Caption = #1053#1072' '#1083'/'#1089' '#1087#1086#1083'. '#1091#1089#1083'.'
                DataBinding.FieldName = 'PAAMOUNTBALANCE'
                Width = 60
              end
              object tvPaymants_AgrPANOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090'.'
                DataBinding.FieldName = 'PANOTE'
                Width = 46
              end
              object tvPaymants_AgrPAUSERENTER: TcxGridDBColumn
                Caption = #1040#1074#1090#1086#1088
                DataBinding.FieldName = 'PAUSERENTER'
                Width = 32
              end
              object tvPaymants_AgrPATIMEENTER: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076'.'
                DataBinding.FieldName = 'PATIMEENTER'
                Width = 54
              end
              object tvPaymants_AgrPAUSEREDIT: TcxGridDBColumn
                Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                DataBinding.FieldName = 'PAUSEREDIT'
                Width = 48
              end
              object tvPaymants_AgrPATIMEEDIT: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1088#1077#1076#1072#1082#1094#1080#1080
                DataBinding.FieldName = 'PATIMEEDIT'
                Width = 84
              end
            end
            object cxGridLevel8: TcxGridLevel
              GridView = tvPaymants_Agr
            end
          end
          object cxSplitter1: TcxSplitter
            Left = 577
            Top = 34
            Width = 8
            Height = 232
            HotZoneClassName = 'TcxMediaPlayer9Style'
            Control = cxGrid1
            Visible = False
          end
          object cxGrid6: TcxGrid
            Left = 585
            Top = 34
            Width = 228
            Height = 232
            Align = alLeft
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -13
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 3
            Visible = False
            LookAndFeel.Kind = lfStandard
            object cxGridDBTableView6: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              OnCellClick = tvPlatCellClick
              OnEditValueChanged = tvPlatEditValueChanged
              DataController.DataSource = dsComRaznes
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <
                item
                  Format = '#,###0'
                  Kind = skSum
                  FieldName = 'CAMOUNT'
                  Column = cxGridDBTableView6CAMOUNT
                end>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.CellEndEllipsis = True
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.Footer = True
              OptionsView.GroupByBox = False
              OptionsView.HeaderEndEllipsis = True
              Preview.Visible = True
              Styles.Header = DMInv.cxSiniyText
              object cxGridDBTableView6SCNUM_N: TcxGridDBColumn
                Caption = #8470' '#1044#1086#1087'. '#1089#1086#1075#1083'.'
                DataBinding.FieldName = 'SCNUM_N'
              end
              object cxGridDBTableView6STNAME: TcxGridDBColumn
                Caption = #1059#1089#1083#1091#1075#1072
                DataBinding.FieldName = 'STNAME'
                Width = 525
              end
              object cxGridDBTableView6CAMOUNT: TcxGridDBColumn
                Caption = #1057#1091#1084#1084#1072
                DataBinding.FieldName = 'CAMOUNT'
                Width = 157
              end
            end
            object cxGridLevel19: TcxGridLevel
              GridView = cxGridDBTableView6
            end
          end
          object cxGrid1: TcxGrid
            Left = 0
            Top = 34
            Width = 577
            Height = 232
            Align = alLeft
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -13
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 4
            Visible = False
            LookAndFeel.Kind = lfStandard
            object tvPlat: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              OnCellClick = tvPlatCellClick
              OnEditValueChanged = tvPlatEditValueChanged
              DataController.DataSource = dsCommon
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <
                item
                  Format = '#,###0'
                  Kind = skSum
                  FieldName = 'CSAMOUNT'
                  Column = tvPlatCSAMOUNT
                end>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.CellEndEllipsis = True
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.Footer = True
              OptionsView.GroupByBox = False
              OptionsView.HeaderEndEllipsis = True
              Preview.Visible = True
              Styles.Header = DMInv.cxSiniyText
              object tvPlatColumn1: TcxGridDBColumn
                Caption = #8470
                OnGetDataText = tvPlatColumn1GetDataText
                Options.Editing = False
                Width = 25
              end
              object tvPlatCSID: TcxGridDBColumn
                Caption = #8470' '#1089#1082#1074#1079#1085
                DataBinding.FieldName = 'CSID'
                Options.Editing = False
                Width = 61
              end
              object tvPlatPP: TcxGridDBColumn
                Caption = #1055#1083#1072#1090#1077#1083#1100#1097#1080#1082
                DataBinding.FieldName = 'PP'
                Options.Editing = False
                Width = 86
              end
              object tvPlatCSAMOUNT: TcxGridDBColumn
                Caption = #1057#1091#1084#1084#1072
                DataBinding.FieldName = 'CSAMOUNT'
                Options.Editing = False
                Width = 46
              end
              object tvPlatCSFORM: TcxGridDBColumn
                Caption = #1053#1072#1083'.'
                DataBinding.FieldName = 'CSFORM'
                PropertiesClassName = 'TcxCheckBoxProperties'
                Properties.ValueChecked = 0
                Properties.ValueUnchecked = 1
                Options.Editing = False
                Width = 36
              end
              object tvPlatCSDATE: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1086#1087#1083#1072#1090#1099
                DataBinding.FieldName = 'CSDATE'
                Options.Editing = False
                Width = 90
              end
              object tvPlatCSFORWHAT: TcxGridDBColumn
                Caption = #1047#1072' '#1095#1090#1086'?'
                DataBinding.FieldName = 'CSFORWHAT'
                Options.Editing = False
                Width = 54
              end
              object tvPlatCSNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081
                DataBinding.FieldName = 'CSNOTE'
                Width = 90
              end
              object tvPlatAUTOR: TcxGridDBColumn
                Caption = #1040#1074#1090#1086#1088
                DataBinding.FieldName = 'AUTOR'
                Options.Editing = False
                Width = 45
              end
              object tvPlatPP_USERMONEY: TcxGridDBColumn
                Caption = #1050#1090#1086' '#1087#1088#1080#1085#1103#1083
                DataBinding.FieldName = 'PP_USERMONEY'
                Options.Editing = False
                Width = 79
              end
              object tvPlatCSTIMEENTER: TcxGridDBColumn
                Caption = #1042#1088#1077#1084#1103' '#1074#1074#1086#1076#1072
                DataBinding.FieldName = 'CSTIMEENTER'
                Options.Editing = False
                Width = 70
              end
            end
            object cxGridLevel5: TcxGridLevel
              GridView = tvPlat
            end
          end
        end
      end
      object tsContInfo: TcxTabSheet
        Caption = #1050#1086#1086#1088#1076#1080#1085#1072#1090#1099
        ImageIndex = 4
        object Panel_ContInfo: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_ContInfo'
          TabOrder = 0
          object ToolBar1: TToolBar
            Left = 0
            Top = 0
            Width = 1308
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            object tbInsertK: TToolButton
              Left = 0
              Top = 2
              Hint = #1044#1086#1073#1072#1074#1080#1090#1100
              ImageIndex = 30
              ParentShowHint = False
              ShowHint = True
              OnClick = tbInsertKClick
            end
            object tbEditK: TToolButton
              Left = 23
              Top = 2
              Hint = #1048#1079#1084#1077#1085#1080#1090#1100
              ImageIndex = 2
              ParentShowHint = False
              ShowHint = True
              OnClick = tbEditKClick
            end
            object tbDeleteK: TToolButton
              Left = 46
              Top = 2
              Hint = #1059#1076#1072#1083#1080#1090#1100
              ImageIndex = 29
              ParentShowHint = False
              ShowHint = True
              OnClick = tbDeleteKClick
            end
          end
          object cxGrid4: TcxGrid
            Left = 0
            Top = 32
            Width = 1308
            Height = 234
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -13
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object cxGridDBTableView4: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsContInfo
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.Deleting = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object cxGridDBColumn1: TcxGridDBColumn
                DataBinding.FieldName = 'SDNAME'
                Options.Editing = False
                Width = 177
              end
              object cxGridDBColumn2: TcxGridDBColumn
                Caption = #1047#1085#1072#1095#1077#1085#1080#1077
                DataBinding.FieldName = 'CONTACT'
                Options.Editing = False
                Width = 229
              end
              object cxGridDBColumn3: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081
                DataBinding.FieldName = 'CINOTE'
                Options.Editing = False
                Styles.Content = DMInv.cxGreenText
                Width = 609
              end
            end
            object cxGridLevel6: TcxGridLevel
              GridView = cxGridDBTableView4
            end
          end
        end
      end
      object tsRelPeople: TcxTabSheet
        Caption = #1044#1086#1074#1077#1088#1077#1085#1085#1099#1077' '#1083#1080#1094#1072
        ImageIndex = 5
        OnHide = tsRelPeopleHide
        OnShow = tsRelPeopleShow
        object Panel_RelPeople: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_RelPeople'
          TabOrder = 0
          object ToolBar2: TToolBar
            Left = 0
            Top = 41
            Width = 1308
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            object tbAddDovLitsa: TToolButton
              Left = 0
              Top = 2
              Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1089#1087#1080#1089#1086#1082' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094
              ImageIndex = 30
              ParentShowHint = False
              ShowHint = True
              OnClick = tbAddDovLitsaClick
            end
            object tbEditDL: TToolButton
              Left = 23
              Top = 2
              Hint = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1085#1080#1077' '#1089#1087#1080#1089#1082#1072' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094
              Caption = 'tbEditDL'
              ImageIndex = 2
              ParentShowHint = False
              ShowHint = True
              OnClick = tbEditDLClick
            end
            object tbDelDL: TToolButton
              Left = 46
              Top = 2
              Hint = #1059#1076#1072#1083#1080#1090#1100' '#1089#1087#1080#1089#1086#1082' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094
              ImageIndex = 29
              ParentShowHint = False
              ShowHint = True
              Visible = False
              OnClick = tbDelDLClick
            end
            object ToolButton6: TToolButton
              Left = 69
              Top = 2
              Width = 8
              Caption = 'ToolButton6'
              ImageIndex = 12
              Style = tbsSeparator
            end
            object ToolButton4: TToolButton
              Left = 77
              Top = 2
              Hint = #1055#1077#1095#1072#1090#1100' '#1073#1083#1072#1085#1082#1072' '#1089#1087#1080#1089#1082#1072' '#1076#1086#1074'. '#1083#1080#1094
              Caption = 'ToolButton4'
              ImageIndex = 11
              ParentShowHint = False
              ShowHint = True
              OnClick = ToolButton4Click
            end
            object ToolButton2: TToolButton
              Left = 100
              Top = 2
              Caption = 'ToolButton2'
              ImageIndex = 34
              OnClick = ToolButton2Click
            end
          end
          object GroupBox2: TGroupBox
            Left = 0
            Top = 0
            Width = 1308
            Height = 41
            Align = alTop
            Caption = #1055#1086#1089#1090#1086#1103#1085#1085#1099#1081' '#1072#1076#1088#1077#1089' '#1088#1077#1073#1077#1085#1082#1072
            TabOrder = 1
            Visible = False
            object cxDBMemo1: TcxDBMemo
              Left = 2
              Top = 15
              Align = alClient
              DataBinding.DataField = 'CONTACT'
              DataBinding.DataSource = dsAdresPU
              ParentFont = False
              Properties.ReadOnly = True
              Style.Font.Charset = DEFAULT_CHARSET
              Style.Font.Color = clWindowText
              Style.Font.Height = -16
              Style.Font.Name = 'Tahoma'
              Style.Font.Style = []
              Style.IsFontAssigned = True
              TabOrder = 0
              Height = 24
              Width = 1304
            end
          end
          object dbgDovLitsa: TcxGrid
            Left = 0
            Top = 73
            Width = 1083
            Height = 193
            Align = alClient
            TabOrder = 2
            LookAndFeel.Kind = lfStandard
            object tvDovLitsa: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsRelPeople
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsCustomize.ColumnGrouping = False
              OptionsCustomize.ColumnSorting = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.Content = DMInv.cxData
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object cxGridDBTableView1FIO: TcxGridDBColumn
                Caption = #1060#1048#1054
                DataBinding.FieldName = 'FIO'
                Width = 37
              end
              object tvDovLitsaPDATEBIRTH: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1088#1086#1078#1076#1077#1085#1080#1103' '
                DataBinding.FieldName = 'PDATEBIRTH'
                Width = 113
              end
              object cxGridDBTableView1SDNAME: TcxGridDBColumn
                Caption = #1057#1090#1072#1090#1091#1089
                DataBinding.FieldName = 'SDNAME'
                Width = 54
              end
              object tvDovLitsaDSERIA: TcxGridDBColumn
                Caption = #1057#1077#1088#1080#1103' '#1087#1072#1089#1087'.'
                DataBinding.FieldName = 'DSERIA'
                Width = 85
              end
              object tvDovLitsaDNUMBER: TcxGridDBColumn
                Caption = #8470' '#1087#1072#1089#1087'.'
                DataBinding.FieldName = 'DNUMBER'
                Width = 62
              end
              object tvDovLitsaDDATE: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1087#1072#1089#1087'.'
                DataBinding.FieldName = 'DDATE'
                Width = 79
              end
              object tvDovLitsaTEL_MOB: TcxGridDBColumn
                Caption = #1058#1077#1083'. '#1084#1086#1073'.'
                DataBinding.FieldName = 'TEL_MOB'
                Width = 68
              end
              object tvDovLitsaTEL_DOM: TcxGridDBColumn
                Caption = #1058#1077#1083'. '#1076#1086#1084'.'
                DataBinding.FieldName = 'TEL_DOM'
                Width = 69
              end
              object tvDovLitsaTEL_RAB: TcxGridDBColumn
                Caption = #1058#1077#1083'. '#1088#1072#1073'.'
                DataBinding.FieldName = 'TEL_RAB'
                Width = 67
              end
              object tvDovLitsaEMAIL: TcxGridDBColumn
                DataBinding.FieldName = 'EMAIL'
                Width = 36
              end
            end
            object cxGridLevel7: TcxGridLevel
              GridView = tvDovLitsa
            end
          end
          object cxDBImage2: TcxDBImage
            Left = 1083
            Top = 73
            Align = alRight
            DataBinding.DataField = 'PPIMAGE'
            DataBinding.DataSource = dsPhotoDovLitsa
            Properties.GraphicClassName = 'TJPEGImage'
            TabOrder = 3
            Height = 193
            Width = 225
          end
        end
      end
      object tsRodstv: TcxTabSheet
        Caption = #1056#1086#1076#1089#1090#1074#1077#1085#1085#1080#1082#1080
        ImageIndex = 6
        object Panel_rodstv: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_rodstv'
          TabOrder = 0
          object cxGrid8: TcxGrid
            Left = 0
            Top = 32
            Width = 1308
            Height = 234
            Align = alClient
            TabOrder = 0
            LookAndFeel.Kind = lfStandard
            object cxGridDBTableView1: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsRodstv
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsCustomize.ColumnGrouping = False
              OptionsCustomize.ColumnSorting = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.Content = DMInv.cxData
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object cxGridDBTableView1PP: TcxGridDBColumn
                Caption = #1060#1048#1054
                DataBinding.FieldName = 'PP'
                Width = 177
              end
              object cxGridDBTableView1PDATEBIRTH: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1088#1086#1078#1076
                DataBinding.FieldName = 'PDATEBIRTH'
                Width = 378
              end
              object cxGridDBTableView1SDNAME1: TcxGridDBColumn
                Caption = #1054#1073#1088#1072#1079#1086#1074#1072#1090'. '#1087#1086#1076#1088#1072#1079#1076'.'
                DataBinding.FieldName = 'SDNAME'
                Width = 115
              end
            end
            object cxGridLevel10: TcxGridLevel
              GridView = cxGridDBTableView1
            end
          end
          object ToolBar3: TToolBar
            Left = 0
            Top = 0
            Width = 1308
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 1
            TabStop = True
            Transparent = True
            object ToolButton5: TToolButton
              Left = 0
              Top = 2
              Hint = #1056#1077#1076#1072#1082#1090#1080#1088#1086#1074#1072#1085#1080#1077' '#1089#1087#1080#1089#1082#1072' '#1088#1086#1076#1089#1090#1074#1077#1085#1085#1080#1082#1086#1074
              Caption = 'ToolButton3'
              ImageIndex = 2
              ParentShowHint = False
              ShowHint = True
              OnClick = ToolButton5Click
            end
          end
        end
      end
      object tsKPPMessage: TcxTabSheet
        Caption = #1057#1086#1086#1073#1097#1077#1085#1080#1103' '#1076#1083#1103' '#1087#1088#1086#1093#1086#1076#1085#1086#1081
        ImageIndex = 7
        object Panel_KPPMessage: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_KPPMessage'
          TabOrder = 0
          object tbKPPMes: TToolBar
            Left = 0
            Top = 0
            Width = 1308
            Height = 33
            AutoSize = True
            BorderWidth = 2
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            Visible = False
            object tbKPPMesIns: TToolButton
              Left = 0
              Top = 2
              Hint = #1057#1086#1079#1076#1072#1090#1100' '#1089#1086#1086#1073#1097#1077#1085#1080#1077
              ImageIndex = 30
              ParentShowHint = False
              ShowHint = True
              OnClick = tbKPPMesInsClick
            end
            object tbKPPMesDel: TToolButton
              Left = 23
              Top = 2
              Hint = #1059#1076#1072#1083#1080#1090#1100' '#1091#1089#1083#1091#1075#1091' '#1089#1086#1086#1073#1097#1077#1085#1080#1077
              ImageIndex = 29
              ParentShowHint = False
              ShowHint = True
              OnClick = tbKPPMesDelClick
            end
            object ToolButton3: TToolButton
              Left = 46
              Top = 2
              Caption = 'ToolButton3'
              ImageIndex = 34
              OnClick = ToolButton3Click
            end
          end
          object dbgKPPMes: TcxGrid
            Left = 0
            Top = 33
            Width = 1308
            Height = 233
            Align = alClient
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object tvKPPMes: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              OnEditValueChanged = tvKPPMesEditValueChanged
              DataController.DataSource = dsKPPMessages
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsCustomize.ColumnGrouping = False
              OptionsCustomize.ColumnSorting = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.Content = DMInv.cxData
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object tvKPPMesKMMESSAGE: TcxGridDBColumn
                Caption = #1058#1077#1082#1089#1090' '#1089#1086#1086#1073#1097#1077#1085#1080#1103' ('#1074#1086#1076#1080#1090#1100' '#1086#1073#1103#1079#1072#1090#1077#1083#1100#1085#1086'!!!)'
                DataBinding.FieldName = 'KMMESSAGE'
                Width = 140
              end
              object tvKPPMesKMDATEBEGIN: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1080' '#1074#1088#1077#1084#1103' '#1085#1072#1095#1072#1083#1072
                DataBinding.FieldName = 'KMDATEBEGIN'
                PropertiesClassName = 'TcxDateEditProperties'
                Properties.Kind = ckDateTime
                Width = 106
              end
              object tvKPPMesKMDATEEND: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1080' '#1074#1088#1077#1084#1103' '#1086#1082#1086#1085#1095#1072#1085#1080#1103
                DataBinding.FieldName = 'KMDATEEND'
                PropertiesClassName = 'TcxDateEditProperties'
                Properties.Kind = ckDateTime
                Width = 132
              end
              object tvKPPMesKMUSLOVIE: TcxGridDBColumn
                Caption = #1059#1089#1083#1086#1074#1080#1077' '#1087#1086#1082#1072#1079#1072' '#1089#1086#1086#1073#1097#1077#1085#1080#1103' ('#1090#1086#1083#1100#1082#1086' '#1076#1083#1103' '#1087#1086#1083#1091#1095'. '#1091#1089#1083#1091#1075')'
                DataBinding.FieldName = 'KMUSLOVIE'
                PropertiesClassName = 'TcxCheckComboBoxProperties'
                Properties.EditValueFormat = cvfStatesString
                Properties.Items = <
                  item
                    Description = #1054#1089#1085#1086#1074#1085#1072#1103
                  end
                  item
                    Description = #1042#1089#1090#1091#1087#1080#1090'. '#1074#1079#1085#1086#1089
                  end
                  item
                    Description = #1056#1072#1079#1086#1074#1099#1077' '#1080' '#1076#1086#1087'.'
                  end>
                Width = 216
              end
              object tvKPPMesKMDEJSTVIE: TcxGridDBColumn
                Caption = #1047#1072#1087#1088#1077#1090#1080#1090#1100' '#1074#1093#1086#1076'?'
                DataBinding.FieldName = 'KMDEJSTVIE'
                PropertiesClassName = 'TcxCheckBoxProperties'
                Properties.NullStyle = nssUnchecked
                Properties.ValueChecked = 1
                Properties.ValueUnchecked = 0
                Width = 76
              end
            end
            object cxGridLevel11: TcxGridLevel
              GridView = tvKPPMes
            end
          end
        end
      end
      object tsOsnPodr: TcxTabSheet
        Caption = #1054#1089#1085'. '#1087#1086#1076#1088#1072#1079#1076'.'
        ImageIndex = 8
        TabVisible = False
        object Panel_OsnPodr: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_OsnPodr'
          TabOrder = 0
          object tbOsnPodr: TToolBar
            Left = 0
            Top = 0
            Width = 1308
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            Visible = False
            object tbZachislit: TToolButton
              Left = 0
              Top = 2
              Hint = #1047#1072#1095#1080#1089#1083#1080#1090#1100
              ImageIndex = 30
              ParentShowHint = False
              ShowHint = True
              OnClick = tbZachislitClick
            end
            object tbIskluch: TToolButton
              Left = 23
              Top = 2
              Hint = #1048#1089#1082#1083#1102#1095#1080#1090#1100
              ImageIndex = 35
              ParentShowHint = False
              ShowHint = True
              OnClick = tbIskluchClick
            end
            object tbPerevod: TToolButton
              Left = 46
              Top = 2
              Hint = #1055#1077#1088#1077#1074#1086#1076
              Caption = 'tbPerevod'
              ImageIndex = 27
              ParentShowHint = False
              ShowHint = True
              OnClick = tbPerevodClick
            end
            object tbDel: TToolButton
              Left = 69
              Top = 2
              Hint = #1059#1076#1072#1083#1080#1090#1100
              Caption = 'tbDel'
              ImageIndex = 29
              ParentShowHint = False
              ShowHint = True
              OnClick = tbDelClick
            end
            object ToolButton7: TToolButton
              Left = 92
              Top = 2
              Caption = 'ToolButton7'
              ImageIndex = 34
              OnClick = ToolButton7Click
            end
          end
          object dbgOsnPodr: TcxGrid
            Left = 0
            Top = 32
            Width = 1308
            Height = 234
            Align = alClient
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object tvOsnPodr: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              OnEditValueChanged = tvOsnPodrEditValueChanged
              DataController.DataSource = dsOsnPodr
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsCustomize.ColumnGrouping = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.Content = DMInv.cxData
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object tvOsnPodrOSN_PODR: TcxGridDBColumn
                Caption = #1055#1086#1076#1088#1072#1079#1076'.'
                DataBinding.FieldName = 'OSN_PODR'
                Options.Editing = False
                Width = 145
              end
              object tvOsnPodrDPDATEIN: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1079#1072#1095#1080#1089#1083'.'
                DataBinding.FieldName = 'DPDATEIN'
                Options.Editing = False
                Width = 196
              end
              object tvOsnPodrDPDATEOUT: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1080#1089#1082#1083#1102#1095'.'
                DataBinding.FieldName = 'DPDATEOUT'
                Options.Editing = False
                Width = 206
              end
              object tvOsnPodrINNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090' '#1082' '#1079#1072#1095#1080#1089#1083'.'
                DataBinding.FieldName = 'INNOTE'
                Width = 266
              end
              object tvOsnPodrOUTNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1082' '#1080#1089#1082#1083#1102#1095'.'
                DataBinding.FieldName = 'OUTNOTE'
                Width = 286
              end
              object tvOsnPodrREDAKTOR: TcxGridDBColumn
                Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                DataBinding.FieldName = 'REDAKTOR'
                Width = 181
              end
              object tvOsnPodrT_RED: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1088#1077#1076'.'
                DataBinding.FieldName = 'T_RED'
                Width = 150
              end
            end
            object cxGridLevel12: TcxGridLevel
              GridView = tvOsnPodr
            end
          end
        end
      end
      object tsDopPodr: TcxTabSheet
        Caption = #1044#1086#1087'. '#1087#1086#1076#1088#1072#1079#1076'.'
        ImageIndex = 9
        TabVisible = False
        object Panel_DopPodr: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_DopPodr'
          TabOrder = 0
          object tbDopPodr: TToolBar
            Left = 0
            Top = 0
            Width = 1308
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            Visible = False
            object tbDPVkl: TToolButton
              Left = 0
              Top = 2
              Hint = #1047#1072#1095#1080#1089#1083#1080#1090#1100
              ImageIndex = 30
              ParentShowHint = False
              ShowHint = True
              OnClick = tbDPVklClick
            end
            object tbDPIskluchit: TToolButton
              Left = 23
              Top = 2
              Hint = #1048#1089#1082#1083#1102#1095#1080#1090#1100
              ImageIndex = 35
              ParentShowHint = False
              ShowHint = True
              OnClick = tbDPIskluchitClick
            end
            object tbDPPerevod: TToolButton
              Left = 46
              Top = 2
              Hint = #1055#1077#1088#1077#1074#1086#1076
              Caption = 'tbPerevod'
              ImageIndex = 27
              ParentShowHint = False
              ShowHint = True
              OnClick = tbDPPerevodClick
            end
            object tbDPDel: TToolButton
              Left = 69
              Top = 2
              Hint = #1059#1076#1072#1083#1080#1090#1100
              Caption = 'tbDel'
              ImageIndex = 29
              ParentShowHint = False
              ShowHint = True
              OnClick = tbDPDelClick
            end
            object ToolButton8: TToolButton
              Left = 92
              Top = 2
              Caption = 'ToolButton8'
              ImageIndex = 34
              OnClick = ToolButton8Click
            end
          end
          object dbgDopPodr: TcxGrid
            Left = 0
            Top = 32
            Width = 1308
            Height = 234
            Align = alClient
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object tvDopPodr: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              OnEditValueChanged = tvDopPodrEditValueChanged
              DataController.DataSource = dsDopPodr
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsCustomize.ColumnGrouping = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.Content = DMInv.cxData
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object tvDopPodrOSN_PODR: TcxGridDBColumn
                Caption = #1055#1086#1076#1088#1072#1079#1076'.'
                DataBinding.FieldName = 'OSN_PODR'
                Options.Editing = False
                Width = 143
              end
              object tvDopPodrDPDATEIN: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1079#1072#1095#1080#1089#1083'.'
                DataBinding.FieldName = 'DPDATEIN'
                PropertiesClassName = 'TcxDateEditProperties'
                Width = 195
              end
              object tvDopPodrDPDATEOUT: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1080#1089#1082#1083#1102#1095'.'
                DataBinding.FieldName = 'DPDATEOUT'
                PropertiesClassName = 'TcxDateEditProperties'
                Width = 204
              end
              object tvDopPodrINNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1082' '#1079#1072#1095#1080#1089#1083'.'
                DataBinding.FieldName = 'INNOTE'
                Width = 273
              end
              object tvDopPodrOUTNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1082' '#1080#1089#1082#1083#1102#1095'.'
                DataBinding.FieldName = 'OUTNOTE'
                Width = 284
              end
              object tvDopPodrREDAKTOR: TcxGridDBColumn
                Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                DataBinding.FieldName = 'REDAKTOR'
                Width = 195
              end
              object tvDopPodrT_RED: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1088#1077#1076'.'
                DataBinding.FieldName = 'T_RED'
                Width = 136
              end
            end
            object cxGridLevel13: TcxGridLevel
              GridView = tvDopPodr
            end
          end
        end
      end
      object tsOkazUslugi: TcxTabSheet
        Caption = #1054#1082#1072#1079#1072#1085#1085#1099#1077' '#1091#1089#1083#1091#1075#1080
        ImageIndex = 10
        OnHide = tsOkazUslugiHide
        OnShow = tsOkazUslugiShow
        object Panel_OkazUslugi: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          Caption = 'Panel_OkazUslugi'
          TabOrder = 0
          object tbTabel: TToolBar
            Left = 1
            Top = 1
            Width = 1306
            AutoSize = True
            BorderWidth = 2
            EdgeInner = esNone
            EdgeOuter = esNone
            Images = DMInv.ilActive
            TabOrder = 0
            TabStop = True
            Transparent = True
            Visible = False
            object tbTabelDel: TToolButton
              Left = 0
              Top = 2
              Hint = #1059#1076#1072#1083#1080#1090#1100
              Caption = 'tbDel'
              ImageIndex = 29
              ParentShowHint = False
              ShowHint = True
              OnClick = tbTabelDelClick
            end
            object ToolButton9: TToolButton
              Left = 23
              Top = 2
              Caption = 'ToolButton9'
              ImageIndex = 34
              OnClick = ToolButton9Click
            end
          end
          object dbgRS: TcxGrid
            Left = 1
            Top = 33
            Width = 1306
            Height = 232
            Align = alClient
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object tvRS: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsRS
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <
                item
                  Kind = skCount
                  FieldName = 'RSDATE'
                  Column = tvRSRSDATE
                end>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              Styles.Content = DMInv.cxData
              Styles.IncSearch = DMInv.cxKrasniyText
              Styles.Selection = DMInv.cxJoltiyFon
              Styles.Header = DMInv.cxSiniyText
              object tvRSUSLUGA: TcxGridDBColumn
                Caption = #1059#1089#1083#1091#1075#1072
                DataBinding.FieldName = 'USLUGA'
                Width = 42
              end
              object tvRSRSDATE: TcxGridDBColumn
                Caption = #1044#1072#1090#1072
                DataBinding.FieldName = 'RSDATE'
                Width = 42
              end
              object tvRSRSTIMEBEGIN: TcxGridDBColumn
                Caption = #1042#1088#1077#1084#1103' '#1085#1072#1095'.'
                DataBinding.FieldName = 'RSTIMEBEGIN'
                Width = 69
              end
              object tvRSRSTIMEEND: TcxGridDBColumn
                Caption = #1042#1088#1077#1084#1103' '#1086#1082#1086#1085#1095'.'
                DataBinding.FieldName = 'RSTIMEEND'
                Width = 60
              end
              object tvRSRSTEMA: TcxGridDBColumn
                Caption = #1058#1077#1084#1072
                DataBinding.FieldName = 'RSTEMA'
                Width = 43
              end
              object tvRSRSNABLJUD: TcxGridDBColumn
                Caption = #1053#1072#1073#1083#1102#1076#1077#1085#1080#1103
                DataBinding.FieldName = 'RSNABLJUD'
                Width = 60
              end
              object tvRSRSTIMEENTER: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1089#1086#1079#1076'.'
                DataBinding.FieldName = 'RSTIMEENTER'
                Width = 71
              end
              object tvRSPEDAGOG_FIO: TcxGridDBColumn
                Caption = #1050#1090#1086' '#1087#1088#1086#1074#1077#1083
                DataBinding.FieldName = 'PEDAGOG_FIO'
                Width = 74
              end
              object tvRSADM_FIO: TcxGridDBColumn
                Caption = #1040#1076#1084#1080#1085'. '#1089#1086#1090#1088'.'
                DataBinding.FieldName = 'ADM_FIO'
                Width = 49
              end
              object tvRSREGISTRATOR_FIO: TcxGridDBColumn
                Caption = #1050#1090#1086' '#1089#1086#1079#1076#1072#1083
                DataBinding.FieldName = 'REGISTRATOR_FIO'
                Width = 101
              end
            end
            object cxGridLevel14: TcxGridLevel
              GridView = tvRS
            end
          end
        end
      end
      object tsRequests: TcxTabSheet
        Caption = #1047#1072#1103#1074#1083#1077#1085#1080#1103
        ImageIndex = 11
        OnHide = tsRequestsHide
        OnShow = tsRequestsShow
        object Panel_requests: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_requests'
          TabOrder = 0
          object Panel_req: TPanel
            Left = 0
            Top = 0
            Width = 1308
            Height = 33
            Align = alTop
            TabOrder = 0
            object bShowColRequest: TcxButton
              Tag = 12
              Left = 315
              Top = 4
              Width = 28
              Height = 23
              Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
              ParentShowHint = False
              ShowHint = True
              TabOrder = 0
              TabStop = False
              OnClick = bShowColRequestClick
              Glyph.Data = {
                76010000424D7601000000000000760000002800000020000000100000000100
                04000000000000010000120B0000120B00001000000000000000000000000000
                80000080000000808000800000008000800080800000C0C0C000808080000000
                FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
                33333FFFFFFFFFFFFFFF000000000000000088888888888888880FFFFFFFFFFF
                FFF08F3FF3FF3FF7FFF80F00F00F00F900F08F883883883788380FFFFFFFF9FF
                FFF08F3FF3FF37F3FFF80F00F00F09F000F08F883883873888380FFFFFFFF99F
                FFF08F3FF3FF3773FFF80F00F99909F000F08F883777873888380FFFF9FFF999
                FFF08F3FF7FF3777FFF80F00F99F00F000F08F88377388388838099FF9FFFFFF
                FFF0877FF7FFFFFFFFF809C9C999CCCCCCC087878777888888880979CCCCCCCC
                C77087F7888888888FF809090000000000008787888888888888399333333333
                3333377333333333333333333333333333333333333333333333}
              LookAndFeel.SkinName = ''
              NumGlyphs = 2
            end
            object lcbReqType: TcxLookupComboBox
              Left = 12
              Top = 5
              Properties.DropDownListStyle = lsFixedList
              Properties.KeyFieldNames = 'SDID'
              Properties.ListColumns = <
                item
                  FieldName = 'SDNAME'
                end>
              Properties.ListOptions.ShowHeader = False
              Properties.ListSource = dsSD_ReqType
              Properties.OnCloseUp = lcbReqTypePropertiesCloseUp
              TabOrder = 1
              Width = 301
            end
            object bRegOtkazDone: TcxButton
              Tag = 12
              Left = 347
              Top = 4
              Width = 302
              Height = 23
              Hint = #1050#1086#1083#1086#1085#1082#1080' '#1090#1072#1073#1083#1080#1094#1099
              Caption = #1055#1088#1080#1079#1085#1072#1082' '#1088#1072#1089#1090#1086#1088#1078#1077#1085#1080#1103
              ParentShowHint = False
              ShowHint = True
              TabOrder = 2
              TabStop = False
              Visible = False
              LookAndFeel.SkinName = ''
            end
          end
          object dbgRR: TcxGrid
            Left = 0
            Top = 33
            Width = 1308
            Height = 233
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -13
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 1
            LookAndFeel.Kind = lfStandard
            object tvRR: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.Insert.Visible = True
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = True
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              FilterBox.Position = fpTop
              OnCellDblClick = tvRRCellDblClick
              OnEditValueChanged = tvRREditValueChanged
              DataController.DataSource = dsRR
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <
                item
                  Kind = skCount
                  FieldName = 'RRID'
                  Column = tvRRRRID
                end>
              DataController.Summary.SummaryGroups = <>
              Filtering.ColumnFilteredItemsList = True
              OptionsBehavior.CellHints = True
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Inserting = False
              OptionsView.CellEndEllipsis = True
              OptionsView.CellAutoHeight = True
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.Footer = True
              OptionsView.GroupByBox = False
              OptionsView.GroupFooters = gfVisibleWhenExpanded
              OptionsView.HeaderEndEllipsis = True
              OptionsView.Indicator = True
              Preview.Visible = True
              Styles.Header = DMInv.cxSiniyText
              object tvRRRRID: TcxGridDBColumn
                Caption = #8470' '#1087'/'#1087
                DataBinding.FieldName = 'RRID'
                Options.Editing = False
                Width = 21
              end
              object tvRRRRTIMEENTER: TcxGridDBColumn
                Caption = #1044#1072#1090#1072
                DataBinding.FieldName = 'RRTIMEENTER'
                Options.Editing = False
                Width = 20
              end
              object tvRRTYPE_REQUEST: TcxGridDBColumn
                Caption = #1058#1080#1087
                DataBinding.FieldName = 'TYPE_REQUEST'
                Options.Editing = False
                Width = 20
              end
              object tvRRFIO_POLUCH: TcxGridDBColumn
                Caption = #1055#1086#1083#1091#1095#1072#1090#1077#1083#1100' '#1091#1089#1083#1091#1075
                DataBinding.FieldName = 'FIO_POLUCH'
                Options.Editing = False
                Width = 52
              end
              object tvRRFIO_DL: TcxGridDBColumn
                Caption = #1055#1086#1076#1087#1080#1089#1072#1083
                DataBinding.FieldName = 'FIO_DL'
                Options.Editing = False
                Width = 29
              end
              object tvRRRRNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090#1072#1088#1080#1081
                DataBinding.FieldName = 'RRNOTE'
                Options.Editing = False
                Width = 40
              end
              object tvRRAUTOR: TcxGridDBColumn
                Caption = #1040#1074#1090#1086#1088
                DataBinding.FieldName = 'AUTOR'
                Options.Editing = False
                Width = 20
              end
              object tvRRREDAKTOR: TcxGridDBColumn
                Caption = #1056#1077#1076#1072#1082#1090#1086#1088
                DataBinding.FieldName = 'REDAKTOR'
                Options.Editing = False
                Width = 29
              end
              object tvRRRRTIMEEDIT: TcxGridDBColumn
                Caption = #1044#1072#1090#1072' '#1088#1077#1076#1072#1082#1090#1080#1088'.'
                DataBinding.FieldName = 'RRTIMEEDIT'
                Options.Editing = False
                Width = 46
              end
              object tvRRIS_FORMALIZ: TcxGridDBColumn
                Caption = #1060#1086#1088#1084#1072#1083#1080#1079#1086#1074#1072#1085#1086'?'
                DataBinding.FieldName = 'IS_FORMALIZ'
                PropertiesClassName = 'TcxCheckBoxProperties'
                Properties.ValueChecked = 1
                Properties.ValueUnchecked = '0'
                Options.Editing = False
                Width = 48
              end
              object tvRRRRMANAGERNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1084#1077#1085#1077#1076#1078#1077#1088#1072
                DataBinding.FieldName = 'RRMANAGERNOTE'
                Options.Editing = False
                Width = 63
              end
              object tvRRRRMANAGER: TcxGridDBColumn
                Caption = #1052#1077#1085#1077#1076#1078#1077#1088
                DataBinding.FieldName = 'RRMANAGER'
                Options.Editing = False
                Width = 37
              end
              object tvRRRRDIREKTORNOTE: TcxGridDBColumn
                Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1076#1080#1088#1077#1082#1090'.'
                DataBinding.FieldName = 'RRDIREKTORNOTE'
                Options.Editing = False
                Width = 67
              end
              object tvRRRRDIREKTOROK: TcxGridDBColumn
                Caption = #1040#1074#1090#1086#1088#1080#1079#1072#1094#1080#1103' '#1076#1080#1088'.'
                DataBinding.FieldName = 'RRDIREKTOROK'
                PropertiesClassName = 'TcxCheckBoxProperties'
                Properties.NullStyle = nssUnchecked
                Properties.ValueChecked = 1
                Properties.ValueUnchecked = 0
                Options.Editing = False
                Width = 75
              end
              object tvRRRRCLIENTANSWER: TcxGridDBColumn
                Caption = #1054#1090#1074#1077#1090' '#1076#1086#1074#1077#1088'. '#1083#1080#1094#1091
                DataBinding.FieldName = 'RRCLIENTANSWER'
                Options.Editing = False
                Width = 103
              end
            end
            object cxGridLevel15: TcxGridLevel
              GridView = tvRR
            end
          end
        end
      end
      object tsRegistr: TcxTabSheet
        Caption = #1055#1077#1088#1077#1076#1072#1095#1072' '#1074#1086#1089#1087#1080#1090#1072#1090#1077#1083#1102
        ImageIndex = 12
        OnHide = tsRegistrHide
        OnShow = tsRegistrShow
        object Panel_Registr: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          BevelOuter = bvNone
          Caption = 'Panel_Registr'
          TabOrder = 0
          object cxGrid3: TcxGrid
            Left = 0
            Top = 0
            Width = 1308
            Height = 266
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -11
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 0
            TabStop = False
            LookAndFeel.Kind = lfStandard
            object cxGridDBTableView3: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsRegistr
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.NavigatorOffset = 10
              OptionsView.CellAutoHeight = True
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.Indicator = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              object cxGridDBTableView3TIP: TcxGridDBColumn
                Caption = #1058#1080#1087' '#1086#1087#1077#1088#1072#1094#1080#1080
                DataBinding.FieldName = 'TIP'
                Width = 158
              end
              object cxGridDBTableView3FIO: TcxGridDBColumn
                Caption = #1048#1089#1087#1086#1083#1085#1080#1090#1077#1083#1100
                DataBinding.FieldName = 'FIO'
                Width = 256
              end
              object cxGridDBTableView3PUTIME: TcxGridDBColumn
                Caption = #1042#1088#1077#1084#1103' '#1088#1077#1075#1080#1089#1090#1088#1072#1094#1080#1080
                DataBinding.FieldName = 'PUTIME'
                Width = 848
              end
            end
            object cxGridLevel16: TcxGridLevel
              GridView = cxGridDBTableView3
            end
          end
        end
      end
      object tsBalance: TcxTabSheet
        Caption = #1041#1072#1083#1072#1085#1089
        ImageIndex = 11
        OnShow = tsBalanceShow
        object Panel_balance: TPanel
          Left = 0
          Top = 0
          Width = 1308
          Height = 266
          Align = alClient
          Caption = 'Panel_balance'
          TabOrder = 0
          object dbgBalance: TcxGrid
            Left = 1
            Top = 46
            Width = 1306
            Height = 219
            Align = alClient
            Font.Charset = DEFAULT_CHARSET
            Font.Color = clWindowText
            Font.Height = -13
            Font.Name = 'Tahoma'
            Font.Style = []
            ParentFont = False
            TabOrder = 0
            LookAndFeel.Kind = lfStandard
            LookAndFeel.SkinName = 'Office2007Silver'
            object tvBalance: TcxGridDBTableView
              NavigatorButtons.ConfirmDelete = False
              NavigatorButtons.First.Visible = True
              NavigatorButtons.PriorPage.Visible = True
              NavigatorButtons.Prior.Visible = True
              NavigatorButtons.Next.Visible = True
              NavigatorButtons.NextPage.Visible = True
              NavigatorButtons.Last.Visible = True
              NavigatorButtons.Insert.Visible = False
              NavigatorButtons.Append.Visible = False
              NavigatorButtons.Delete.Visible = False
              NavigatorButtons.Edit.Visible = False
              NavigatorButtons.Post.Visible = False
              NavigatorButtons.Cancel.Visible = False
              NavigatorButtons.Refresh.Visible = False
              NavigatorButtons.SaveBookmark.Visible = False
              NavigatorButtons.GotoBookmark.Visible = False
              NavigatorButtons.Filter.Visible = False
              DataController.DataSource = dsq1
              DataController.Summary.DefaultGroupSummaryItems = <>
              DataController.Summary.FooterSummaryItems = <>
              DataController.Summary.SummaryGroups = <>
              OptionsBehavior.CellHints = True
              OptionsBehavior.ImmediateEditor = False
              OptionsBehavior.IncSearch = True
              OptionsCustomize.ColumnFiltering = False
              OptionsCustomize.ColumnSorting = False
              OptionsData.CancelOnExit = False
              OptionsData.Deleting = False
              OptionsData.DeletingConfirmation = False
              OptionsData.Editing = False
              OptionsData.Inserting = False
              OptionsView.CellEndEllipsis = True
              OptionsView.NavigatorOffset = 10
              OptionsView.CellTextMaxLineCount = 1
              OptionsView.ColumnAutoWidth = True
              OptionsView.GroupByBox = False
              OptionsView.HeaderEndEllipsis = True
              OptionsView.ShowColumnFilterButtons = sfbAlways
              Preview.Visible = True
              object tvBalanceGPDATE_PRINT: TcxGridDBColumn
                Caption = #1044#1072#1090#1072
                DataBinding.FieldName = 'GPDATE_PRINT'
                Width = 68
              end
              object tvBalanceNAME_OPER: TcxGridDBColumn
                Caption = #1044#1086#1082#1091#1084#1077#1085#1090
                DataBinding.FieldName = 'NAME_OPER'
                Width = 56
              end
              object tvBalanceSCID: TcxGridDBColumn
                DataBinding.FieldName = 'SCID'
                Width = 23
              end
              object tvBalanceSTNAME: TcxGridDBColumn
                Caption = #1053#1072#1079#1074#1072#1085#1080#1077
                DataBinding.FieldName = 'STNAME'
                Width = 39
              end
              object tvBalancePERIOD: TcxGridDBColumn
                Caption = #1055#1077#1088#1080#1086#1076
                DataBinding.FieldName = 'PERIOD'
                Width = 35
              end
              object tvBalanceKOL_ED: TcxGridDBColumn
                Caption = #1050#1086#1083'.'
                DataBinding.FieldName = 'KOL_ED'
                Width = 36
              end
              object tvBalanceSCTARIFWITHDISCOUNT: TcxGridDBColumn
                Caption = #1058#1072#1088#1080#1092' '#1089#1086' '#1089#1082#1080#1076#1082#1086#1081
                DataBinding.FieldName = 'SCTARIFWITHDISCOUNT'
                Width = 105
              end
              object tvBalanceGPAMOUNT: TcxGridDBColumn
                Caption = #1044#1086#1083#1075' '#1087#1086' '#1075#1088#1072#1092'.'
                DataBinding.FieldName = 'GPAMOUNT'
                Width = 52
              end
              object tvBalanceOPLATA: TcxGridDBColumn
                Caption = #1055#1083#1072#1090#1077#1078
                DataBinding.FieldName = 'OPLATA'
                Width = 36
              end
              object tvBalanceOPLATA_BANK_PERC: TcxGridDBColumn
                Caption = #1041#1072#1085#1082'. '#1087#1088#1086#1094'.'
                DataBinding.FieldName = 'OPLATA_BANK_PERC'
                Width = 91
              end
              object tvBalanceOPLATA_BALANCE: TcxGridDBColumn
                Caption = #1053#1072' '#1083'/'#1089' '#1088#1077#1073#1077#1085#1082#1072
                DataBinding.FieldName = 'OPLATA_BALANCE'
                Width = 88
              end
              object tvBalanceDOLG: TcxGridDBColumn
                Caption = #1044#1086#1083#1075
                DataBinding.FieldName = 'DOLG'
                Width = 35
              end
            end
            object cxGridLevel18: TcxGridLevel
              GridView = tvBalance
            end
          end
          object labPrevDolg: TcxLabel
            Left = 1
            Top = 27
            Align = alTop
            Caption = 'labPrevDolg'
            ParentColor = False
            ParentFont = False
            Style.Color = clAppWorkSpace
            Style.Font.Charset = DEFAULT_CHARSET
            Style.Font.Color = clWindowText
            Style.Font.Height = -16
            Style.Font.Name = 'Tahoma'
            Style.Font.Style = []
            Style.LookAndFeel.Kind = lfStandard
            Style.LookAndFeel.NativeStyle = False
            Style.LookAndFeel.SkinName = 'Office2007Silver'
            Style.Shadow = False
            Style.TransparentBorder = False
            Style.IsFontAssigned = True
            StyleDisabled.LookAndFeel.Kind = lfStandard
            StyleDisabled.LookAndFeel.NativeStyle = False
            StyleDisabled.LookAndFeel.SkinName = 'Office2007Silver'
            StyleFocused.LookAndFeel.Kind = lfStandard
            StyleFocused.LookAndFeel.NativeStyle = False
            StyleFocused.LookAndFeel.SkinName = 'Office2007Silver'
            StyleHot.LookAndFeel.Kind = lfStandard
            StyleHot.LookAndFeel.NativeStyle = False
            StyleHot.LookAndFeel.SkinName = 'Office2007Silver'
            Properties.Alignment.Horz = taLeftJustify
          end
          object dxBarDockControl2: TdxBarDockControl
            Left = 1
            Top = 1
            Width = 1306
            Height = 26
            Align = dalTop
            BarManager = dxBarManager1
          end
        end
      end
    end
    object Panel_second: TPanel
      Left = 1324
      Top = 1
      Width = 31
      Height = 296
      Align = alRight
      BevelInner = bvSpace
      BevelOuter = bvNone
      Caption = #1044#1086#1087#1086#1083#1085#1080#1090#1077#1083#1100#1085#1072#1103' '#1074#1082#1083#1072#1076#1082#1072
      Color = clSkyBlue
      Constraints.MinWidth = 20
      TabOrder = 1
      object bRetTS: TcxButton
        Left = 1
        Top = 1
        Width = 29
        Height = 25
        Caption = #1042#1077#1088#1085#1091#1090#1100' '#1074#1082#1083#1072#1076#1082#1091
        TabOrder = 0
        Visible = False
        OnClick = bRetTSClick
        Align = alTop
        LookAndFeel.Kind = lfUltraFlat
      end
    end
    object splitter_second: TcxSplitter
      Left = 1316
      Top = 1
      Width = 8
      Height = 296
      HotZoneClassName = 'TcxMediaPlayer9Style'
      HotZone.SizePercent = 50
      AlignSplitter = salRight
      Control = Panel_second
    end
  end
  object cxSplitter3: TcxSplitter [5]
    Left = 0
    Top = 504
    Width = 1356
    Height = 8
    HotZoneClassName = 'TcxMediaPlayer9Style'
    AlignSplitter = salBottom
    Control = Panel13
  end
  object cxSplitter6: TcxSplitter [6]
    Left = 0
    Top = 151
    Width = 1356
    Height = 8
    HotZoneClassName = 'TcxMediaPlayer9Style'
    AlignSplitter = salTop
    Control = Panel8
  end
  object Panel_dbgPeopleFind: TPanel [7]
    Left = 0
    Top = 185
    Width = 1356
    Height = 319
    Align = alClient
    BevelOuter = bvNone
    Caption = 'Panel_dbgPeopleFind'
    TabOrder = 8
    object Panel12: TPanel
      Left = 0
      Top = 0
      Width = 233
      Height = 319
      Align = alLeft
      TabOrder = 0
      object cxDBImage1: TcxDBImage
        Left = 1
        Top = 1
        Align = alClient
        DataBinding.DataField = 'PPIMAGE'
        DataBinding.DataSource = dsPhoto
        Properties.GraphicClassName = 'TJPEGImage'
        TabOrder = 0
        Height = 290
        Width = 231
      end
      object cbShowFoto: TcxCheckBox
        Tag = 18
        Left = 1
        Top = 291
        Align = alBottom
        Caption = #1055#1086#1082#1072#1079#1099#1074#1072#1090#1100' '#1092#1086#1090#1086
        ParentFont = False
        Properties.OnChange = cbShowFotoPropertiesChange
        Style.Font.Charset = DEFAULT_CHARSET
        Style.Font.Color = clWindowText
        Style.Font.Height = -13
        Style.Font.Name = 'Tahoma'
        Style.Font.Style = [fsBold]
        Style.Shadow = True
        Style.IsFontAssigned = True
        TabOrder = 1
        Width = 231
      end
    end
    object cxSplitter4: TcxSplitter
      Left = 233
      Top = 0
      Width = 8
      Height = 319
      HotZoneClassName = 'TcxMediaPlayer9Style'
      Control = Panel12
    end
    object dbgPeopleFind: TcxGrid
      Left = 241
      Top = 0
      Width = 1115
      Height = 319
      Align = alClient
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -13
      Font.Name = 'Tahoma'
      Font.Style = [fsBold]
      ParentFont = False
      TabOrder = 2
      LookAndFeel.Kind = lfStandard
      LookAndFeel.SkinName = 'Blue'
      object tvPeopleFind: TcxGridDBTableView
        OnKeyDown = tvPeopleFindKeyDown
        NavigatorButtons.ConfirmDelete = False
        NavigatorButtons.First.Visible = True
        NavigatorButtons.PriorPage.Visible = True
        NavigatorButtons.Prior.Visible = True
        NavigatorButtons.Next.Visible = True
        NavigatorButtons.NextPage.Visible = True
        NavigatorButtons.Last.Visible = True
        NavigatorButtons.Insert.Visible = False
        NavigatorButtons.Append.Visible = False
        NavigatorButtons.Delete.Visible = False
        NavigatorButtons.Edit.Visible = False
        NavigatorButtons.Post.Visible = False
        NavigatorButtons.Cancel.Visible = False
        NavigatorButtons.Refresh.Visible = False
        NavigatorButtons.SaveBookmark.Visible = False
        NavigatorButtons.GotoBookmark.Enabled = False
        NavigatorButtons.GotoBookmark.Visible = False
        NavigatorButtons.Filter.Visible = False
        FilterBox.CustomizeDialog = False
        FilterBox.Visible = fvNever
        OnCellClick = tvPeopleFindCellClick
        OnCellDblClick = tvPeopleFindCellDblClick
        OnEditValueChanged = tvPeopleFindEditValueChanged
        DataController.DataSource = dlgDS
        DataController.Summary.DefaultGroupSummaryItems = <>
        DataController.Summary.FooterSummaryItems = <
          item
            Kind = skCount
            FieldName = 'PLASTNAME'
            Column = tvPeopleFindPLASTNAME
            DisplayText = #1042#1089#1077#1075#1086' '#1085#1072#1081#1076#1077#1085#1086' '#1089#1086#1080#1089#1082#1072#1090#1077#1083#1077#1081
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'BALANCE_ALL'
            Column = tvPeopleFindBALANCE_ALL
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'ZAPL_ALL'
            Column = tvPeopleFindZAPL_ALL
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'BAL_BANK_PERC'
            Column = tvPeopleFindBAL_BANK_PERC
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'BALANCE'
            Column = tvPeopleFindBALANCE
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'DOLGNY_ZAPL'
            Column = tvPeopleFindDOLGNY_ZAPL
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'ABS_DOLG'
            Column = tvPeopleFindABS_DOLG
          end
          item
            Format = '#,###0'
            Kind = skSum
            FieldName = 'SKIDKA'
            Column = tvPeopleFindSKIDKA
          end
          item
            Format = '0'
            Kind = skSum
            FieldName = 'SCOUNT'
            Column = tvPeopleFindSCOUNT
          end
          item
            Format = '0'
            Kind = skSum
            FieldName = 'SELECT_PEOPLE'
          end>
        DataController.Summary.SummaryGroups = <>
        DataController.Summary.Options = [soNullIgnore]
        OptionsBehavior.CellHints = True
        OptionsBehavior.FocusFirstCellOnNewRecord = True
        OptionsBehavior.IncSearch = True
        OptionsCustomize.ColumnFiltering = False
        OptionsCustomize.ColumnGrouping = False
        OptionsData.CancelOnExit = False
        OptionsData.Deleting = False
        OptionsData.DeletingConfirmation = False
        OptionsData.Inserting = False
        OptionsView.NavigatorOffset = 5
        OptionsView.CellAutoHeight = True
        OptionsView.CellTextMaxLineCount = 1
        OptionsView.ColumnAutoWidth = True
        OptionsView.ExpandButtonsForEmptyDetails = False
        OptionsView.Footer = True
        OptionsView.GroupByBox = False
        OptionsView.HeaderEndEllipsis = True
        OptionsView.Indicator = True
        OptionsView.ShowColumnFilterButtons = sfbAlways
        Styles.Content = DMInv.cxData
        Styles.IncSearch = DMInv.cxGreenText
        Styles.Header = DMInv.cxSiniyText
        object tvPeopleFindNum: TcxGridDBColumn
          Caption = #8470
          OnGetDataText = tvPeopleFindNumGetDataText
          Options.Editing = False
          Options.Moving = False
          Options.Sorting = False
          Width = 20
        end
        object tvPeopleFindPID: TcxGridDBColumn
          DataBinding.FieldName = 'PID'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPLASTNAME: TcxGridDBColumn
          Caption = #1060#1072#1084#1080#1083#1080#1103
          DataBinding.FieldName = 'PLASTNAME'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPNAME: TcxGridDBColumn
          Caption = #1048#1084#1103
          DataBinding.FieldName = 'PNAME'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPPATRONYMIC: TcxGridDBColumn
          Caption = #1054#1090#1095#1077#1089#1090#1074#1086
          DataBinding.FieldName = 'PPATRONYMIC'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPDATEBIRTH: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1088#1086#1078#1076'.'
          DataBinding.FieldName = 'PDATEBIRTH'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindLET: TcxGridDBColumn
          Caption = #1051#1077#1090
          DataBinding.FieldName = 'LET'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindMES: TcxGridDBColumn
          Caption = #1052#1077#1089
          DataBinding.FieldName = 'MES'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindOSN_PODR: TcxGridDBColumn
          Caption = #1054#1073#1088'. '#1087#1086#1076#1088'.'
          DataBinding.FieldName = 'OSN_PODR'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSDNAME: TcxGridDBColumn
          Caption = #1057#1090#1072#1090#1091#1089' '#1095#1077#1083'.'
          DataBinding.FieldName = 'SDNAME'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindIS_IMAGE: TcxGridDBColumn
          Caption = #1060#1086#1090#1086
          DataBinding.FieldName = 'IS_IMAGE'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindLAST_IN: TcxGridDBColumn
          Caption = #1055#1086#1089#1083'. '#1074#1093#1086#1076
          DataBinding.FieldName = 'LAST_IN'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindAGR_SCAN: TcxGridDBColumn
          Caption = #1057#1082#1072#1085' '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGR_SCAN'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindMAX_DATE_PAY: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1087#1086#1089#1083'. '#1087#1083#1072#1090'.'
          DataBinding.FieldName = 'MAX_DATE_PAY'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindDOLJNIK: TcxGridDBColumn
          Caption = #1050#1086#1085#1090#1088#1086#1083#1100
          DataBinding.FieldName = 'PMPISDOLG'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.NullStyle = nssUnchecked
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Width = 20
        end
        object tvPeopleFindDOVLITSA: TcxGridDBColumn
          Caption = #1044#1086#1074#1077#1088'. '#1083#1080#1094#1072
          DataBinding.FieldName = 'DOVLITSA'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.NullStyle = nssUnchecked
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindBALANCE_ALL: TcxGridDBColumn
          Caption = #1054#1073#1097#1080#1081' '#1076#1086#1083#1075
          DataBinding.FieldName = 'BALANCE_ALL'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCNUM_N: TcxGridDBColumn
          Caption = #8470' '#1076#1086#1087'. '#1089#1086#1075#1083'.'
          DataBinding.FieldName = 'SCNUM_N'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCTIMEENTER: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1087#1086#1076#1087'. '#1076#1086#1087'. '#1089#1086#1075#1083'.'
          DataBinding.FieldName = 'SCDATE'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCDATEBEGIN: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1074#1089#1090'. '#1074' '#1089#1080#1083#1091
          DataBinding.FieldName = 'SCDATEBEGIN'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCDATEEND: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1086#1082#1086#1085#1095'.'
          DataBinding.FieldName = 'SCDATEEND'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCDATERASTORJ: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1088#1072#1089#1090#1086#1088#1078'.'
          DataBinding.FieldName = 'SCDATERASTORJ'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSTNAME: TcxGridDBColumn
          Caption = #1059#1089#1083#1091#1075#1072
          DataBinding.FieldName = 'STNAME'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSTTARIF: TcxGridDBColumn
          Caption = #1058#1072#1088#1080#1092
          DataBinding.FieldName = 'STTARIF'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCTARIFWITHDISCOUNT: TcxGridDBColumn
          Caption = #1058#1072#1088#1080#1092' '#1089#1086' '#1089#1082#1080#1076#1082'.'
          DataBinding.FieldName = 'SCTARIFWITHDISCOUNT'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCOUNT: TcxGridDBColumn
          Caption = #1050#1086#1083'-'#1074#1086
          DataBinding.FieldName = 'SCOUNT'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindDOLGNY_ZAPL: TcxGridDBColumn
          Caption = #1057#1091#1084#1084#1072' '#1087#1086' '#1075#1088#1072#1092'.'
          DataBinding.FieldName = 'DOLGNY_ZAPL'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSKIDKA: TcxGridDBColumn
          Caption = #1057#1082#1080#1076#1082#1072
          DataBinding.FieldName = 'SKIDKA'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindBALANCE: TcxGridDBColumn
          Caption = #1044#1086#1083#1075' '#1087#1086' '#1075#1088#1072#1092'.'
          DataBinding.FieldName = 'BALANCE'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindZAPL_ALL: TcxGridDBColumn
          Caption = #1042#1089#1077#1075#1086' '#1086#1087#1083#1072#1095'.'
          DataBinding.FieldName = 'ZAPL_ALL'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindBAL_BANK_PERC: TcxGridDBColumn
          Caption = #1044#1086#1083#1075' '#1087#1086' '#1073#1072#1085#1082'. '#1091#1089#1083'.'
          DataBinding.FieldName = 'BAL_BANK_PERC'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPMPCONTRNOTE: TcxGridDBColumn
          Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1082#1086#1085#1090#1088#1086#1083#1103
          DataBinding.FieldName = 'PMPCONTRNOTE'
          Width = 20
        end
        object tvPeopleFindSC_COPY: TcxGridDBColumn
          Caption = #1050#1086#1087#1080#1103' '#1076#1086#1087'.'#1089#1086#1075#1083'.'
          DataBinding.FieldName = 'SC_COPY'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Width = 20
        end
        object tvPeopleFindOHR_MES: TcxGridDBColumn
          Caption = #1057#1086#1086#1073#1097'.'
          DataBinding.FieldName = 'OHR_MES'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Width = 20
        end
        object tvPeopleFindSCID: TcxGridDBColumn
          Caption = #8470' '#1089#1082#1074#1079#1085
          DataBinding.FieldName = 'SCID'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindOHR_MES_ZAPR_VHOD: TcxGridDBColumn
          Caption = #1042#1093#1086#1076' '#1079#1072#1087#1088#1077#1097'.'
          DataBinding.FieldName = 'OHR_MES_ZAPR_VHOD'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Width = 20
        end
        object tvPeopleFindABS_DOLG: TcxGridDBColumn
          Caption = #1040#1073#1089'. '#1076#1086#1083#1075
          DataBinding.FieldName = 'ABS_DOLG'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindSCISGRAFEDIT: TcxGridDBColumn
          Caption = #1048#1079#1084'. '#1075#1088#1072#1092'.'
          DataBinding.FieldName = 'SCISGRAFEDIT'
          PropertiesClassName = 'TcxCheckBoxProperties'
          Properties.NullStyle = nssUnchecked
          Properties.ReadOnly = True
          Properties.ValueChecked = 1
          Properties.ValueUnchecked = 0
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPMPDIRNOTE: TcxGridDBColumn
          Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1076#1080#1088#1077#1082#1090#1086#1088#1072
          DataBinding.FieldName = 'PMPDIRNOTE'
          Width = 20
        end
        object tvPeopleFindPMPMANAGERNOTE: TcxGridDBColumn
          Caption = #1050#1086#1084#1084#1077#1085#1090'. '#1084#1077#1085#1077#1076#1078#1077#1088#1072
          DataBinding.FieldName = 'PMPMANAGERNOTE'
          Width = 20
        end
        object tvPeopleFindAGID: TcxGridDBColumn
          Caption = #8470' '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGID'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindAGDATEBEGIN: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1085#1072#1095'. '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGDATEBEGIN'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindAGDATEEND: TcxGridDBColumn
          Caption = #1044#1072#1090#1072' '#1086#1082#1086#1085#1095'. '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGDATEEND'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindAGR_TYPE: TcxGridDBColumn
          Caption = #1058#1080#1087' '#1076#1086#1075'.'
          DataBinding.FieldName = 'AGR_TYPE'
          Options.Editing = False
          Width = 20
        end
        object tvPeopleFindPLASTNAME_ENGLISH: TcxGridDBColumn
          Caption = 'LASTNAME'
          DataBinding.FieldName = 'PLASTNAME_ENGLISH'
          Width = 20
        end
        object tvPeopleFindPNAME_ENGLISH: TcxGridDBColumn
          Caption = 'NAME'
          DataBinding.FieldName = 'PNAME_ENGLISH'
          Width = 33
        end
      end
      object dbgPeopleFindLevel1: TcxGridLevel
        GridView = tvPeopleFind
      end
    end
  end
  object cxMemo1: TcxMemo [8]
    Left = 272
    Top = 216
    Lines.Strings = (
      'cxMemo1')
    TabOrder = 3
    Visible = False
    Height = 177
    Width = 649
  end
  inherited dlgDS: TDataSource
    DataSet = qPeople
    OnDataChange = dlgDSDataChange
    Left = 392
    Top = 208
  end
  object qFilter: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterOpen = qFilterAfterOpen
    CachedUpdates = True
    SQL.Strings = (
      'SELECT TF.*'
      'FROM TEMP_FILTER TF'
      'WHERE TF.USER_NAME = CURRENT_USER'
      'ORDER BY TF.TFNUM, TF.TFID')
    GeneratorField.Field = 'TFID'
    GeneratorField.Generator = 'GEN_TEMP_FILTER_ID'
    Left = 600
    Top = 200
    object qFilterTFID: TIntegerField
      FieldName = 'TFID'
      Origin = '"TEMP_FILTER"."TFID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qFilterTFNUM: TIntegerField
      FieldName = 'TFNUM'
      Origin = '"TEMP_FILTER"."TFNUM"'
    end
    object qFilterUSER_NAME: TIBStringField
      FieldName = 'USER_NAME'
      Origin = '"TEMP_FILTER"."USER_NAME"'
      Size = 40
    end
    object qFilterTFNAME: TIBStringField
      FieldName = 'TFNAME'
      Origin = '"TEMP_FILTER"."TFNAME"'
      Size = 255
    end
    object qFilterTDATE: TDateField
      FieldName = 'TDATE'
      Origin = '"TEMP_FILTER"."TDATE"'
    end
    object qFilterTKOL: TIntegerField
      FieldName = 'TKOL'
      Origin = '"TEMP_FILTER"."TKOL"'
    end
    object qFilterTFSQLTEXT: TBlobField
      FieldName = 'TFSQLTEXT'
      Origin = '"TEMP_FILTER"."TFSQLTEXT"'
      ProviderFlags = [pfInUpdate]
      Size = 8
    end
  end
  object quFilter: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  TFID,'
      '  TFNUM,'
      '  USER_NAME,'
      '  TFNAME,'
      '  TFSQLTEXT,'
      '  TDATE'
      'from TEMP_FILTER '
      'where'
      '  TFID = :TFID')
    ModifySQL.Strings = (
      'update or insert INTO TEMP_FILTER'
      '( TDATE, TFID, TFNAME, TFNUM, TFSQLTEXT, USER_NAME)'
      
        'VALUES (:TDATE, GEN_ID(GEN_TEMP_FILTER_ID, 1), :TFNAME, :TFNUM, ' +
        ':TFSQLTEXT, CURRENT_USER)'
      'MATCHING (TFNUM, USER_NAME)')
    InsertSQL.Strings = (
      'null;')
    DeleteSQL.Strings = (
      'null;')
    Left = 632
    Top = 200
  end
  object qFilterSave: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'update or insert INTO TEMP_FILTER'
      '( TDATE, TKOL, TFID, TFNAME, TFNUM, TFSQLTEXT, USER_NAME)'
      
        'VALUES (:TDATE, :TKOL, GEN_ID(GEN_TEMP_FILTER_ID, 1), :TFNAME, :' +
        'TFNUM, :TFSQLTEXT, CURRENT_USER)'
      'MATCHING (TFNUM, USER_NAME)')
    Left = 664
    Top = 200
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'TDATE'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'TKOL'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'TFNAME'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'TFNUM'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'TFSQLTEXT'
        ParamType = ptUnknown
      end>
  end
  object qFilterClear: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'DELETE'
      'FROM TEMP_FILTER TF'
      'WHERE TF.TFNUM = :TFNUM AND TF.USER_NAME = :USER_NAME')
    Left = 568
    Top = 200
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'TFNUM'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'USER_NAME'
        ParamType = ptUnknown
      end>
  end
  object qPeople: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterClose = qPeopleAfterClose
    AfterOpen = qPeopleAfterOpen
    BufferChunks = 10000
    CachedUpdates = True
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PLASTNAME_ENGLISH,' +
        ' P.PNAME_ENGLISH, p.PDATEBIRTH, P.PID, (COALESCE(P.PLASTNAME,'#39' '#39 +
        ')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39'))' +
        ' AS PP,'
      'IIF((DATEDIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)) < 0, D' +
        'ATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE)-1, '
      'DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE)) as let, '
      'IIF( (DATEDIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)) < 0, 1' +
        '2 + (DATEDIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)), (DATE' +
        'DIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)) ) as m' +
        'es, '
      'SD.SDNAME, IIF (PF.PID IS NULL, 0, 1) AS is_image, '
      'IIF(:param_distinct  = 1, NULL, SD2.SDNAME) AS OSN_PODR, '
      ' CAST(max_in.max_day as DATE) AS last_in, '
      '  IIF(is_agrscan.AGID IS NULL, 0, 1) AS agr_scan, '
      ' mp.plat_date AS max_date_pay, '
      'PMP.PMPISDOLG, '
      'IIF(DDL.PID_POLUCH IS NULL,0,1) AS dovlitsa, '
      
        '(COALESCE(DZ.dolgny_zapl,0) - COALESCE(Zall.zapl_all,0)) AS bala' +
        'nce_all, '
      
        '(COALESCE(ZvB.zaplvb,0) - COALESCE(ZBB.zaplbb/100,0)) AS bal_ban' +
        'k_perc, PMP.PMPCONTRNOTE,'
      'pmp.PMPDIRNOTE, PMP.PMPMANAGERNOTE,'
      
        'IIF(KM1.pid IS NULL, 0, 1) AS ohr_mes, IIF(KM2.pid IS NULL, 0, 1' +
        ') AS ohr_mes_zapr_vhod, AD.abs_dolg, COALESCE(izmgr.scisgrafedit' +
        ', 0) AS scisgrafedit '
      
        ' , CAST(NULL AS INTEGER) AS  PID1, CAST(NULL AS INTEGER) AS SCID' +
        ', CAST(NULL AS INTEGER) AS SCNUM_N, CAST(NULL AS DATE) AS SCDATE' +
        'BEGIN, CAST(NULL AS DATE) AS SCDATEEND, '
      
        'CAST(NULL AS DATE) AS SCDATERASTORJ, cast(NULL as varchar(255)) ' +
        'AS STNAME, CAST(NULL AS NUMERIC(18,2)) AS STTARIF, CAST(NULL AS ' +
        'NUMERIC(18,2)) AS SCTARIFWITHDISCOUNT, '
      
        'CAST(NULL AS INTEGER) AS SCOUNT, CAST(NULL AS NUMERIC(18,2)) AS ' +
        'dolgny_zapl, CAST(NULL AS NUMERIC(18,2)) AS skidka, CAST(NULL AS' +
        ' NUMERIC(18,2)) AS balance, CAST(NULL AS NUMERIC(18,2)) AS zapl_' +
        'all, CAST(NULL AS INTEGER) AS SC_copy, '
      
        ' CAST(NULL AS DATE) AS SCTIMEENTER, CAST(NULL AS DATE) AS SCDATE' +
        ', CAST(NULL AS INTEGER) AS select_people'
      'FROM PEOPLE P '
      'LEFT OUTER JOIN '
      '( '
      'SELECT DISTINCT KM.PID '
      'FROM KPP_MESSAGES KM '
      
        'WHERE (CURRENT_TIMESTAMP BETWEEN COALESCE(KM.KMDATEBEGIN, CURREN' +
        'T_TIMESTAMP) '
      '    AND  COALESCE(KM.KMDATEEND, CURRENT_TIMESTAMP)) '
      ') AS km1 on km1.pid = p.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT DISTINCT KM.PID '
      'FROM KPP_MESSAGES KM '
      
        'WHERE (CURRENT_TIMESTAMP BETWEEN COALESCE(KM.KMDATEBEGIN, CURREN' +
        'T_TIMESTAMP) '
      '    AND  COALESCE(KM.KMDATEEND, CURRENT_TIMESTAMP)) '
      '    and km.KMDEJSTVIE = 1 '
      ') AS km2 on km2.pid = p.PID '
      'LEFT OUTER JOIN P_MISC_PROP PMP on PMP.PID = P.PID '
      'LEFT OUTER JOIN P_STATUS PS on PS.PID = P.PID '
      'LEFT OUTER JOIN SYS_DIC SD on SD.SDID = PS.SDID '
      'LEFT OUTER JOIN P_PHOTOS PF ON PF.PID = P.PID '
      '--'#1085#1072#1083#1080#1095#1080#1077' '#1080#1079#1084#1077#1085#1077#1085#1085#1086#1075#1086' '#1075#1088#1072#1092#1080#1082#1072' '#1087#1086' '#1086#1089#1085#1086#1074#1085#1086#1081' '#1091#1089#1083#1091#1075#1077' '
      'LEFT OUTER JOIN(SELECT apu1.pid, sc.scisgrafedit '
      '                      FROM spec_cond sc '
      
        '                      INNER JOIN agr_poluch_uslug apu1 ON apu1.a' +
        'gid = sc.agid '
      '                      INNER JOIN services s ON s.scid = sc.scid '
      'INNER JOIN services_type st ON st.stid = s.stid '
      'INNER JOIN(SELECT t1.sdid '
      
        'FROM (WITH RECURSIVE tree (sdname, sdid, sdparid, o) AS (SELECT ' +
        'sd.sdname, sd.sdid, '
      'sd.sdparid, '
      'CAST('#39#39' AS VARCHAR(2048)) AS o '
      'FROM sys_dic sd '
      'WHERE sd.sdparid = 1880 '
      'UNION ALL '
      'SELECT sd1.sdname, sd1.sdid, '
      'sd1.sdparid, '#39#39' || o '
      'FROM sys_dic sd1 '
      
        'INNER JOIN tree t ON t.sdid = sd1.sdparid) SELECT o || sdname AS' +
        ' sdname, '
      'sdid, sdparid '
      'FROM tree t) AS t1) AS sd_osn ON sd_osn.sdid = st.sdid '
      
        'WHERE CURRENT_DATE BETWEEN sc.scdatebegin AND COALESCE(sc.scdate' +
        'rastorj, sc.scdateend) AND '
      
        'sc.scisgrafedit = 1 AND sc.SCISDELETE IS NULL) AS izmgr ON izmgr' +
        '.pid = p.pid '
      '--'#1082#1088#1072#1081#1085#1080#1081' '#1074#1093#1086#1076' '
      
        'LEFT OUTER JOIN ( SELECT PVV.PID, MAX(PVV.PVTIME_IN) AS max_day ' +
        'FROM P_VIZIT PVV GROUP BY 1) AS max_in ON max_in.PID = P.PID '
      '--'#1087#1086#1089#1083#1077#1076#1085#1080#1081' '#1087#1083#1072#1090#1077#1078' '
      
        'LEFT OUTER JOIN (SELECT CS.PID_POLUCH, MAX(CS.CSDATE) AS plat_da' +
        'te '
      'FROM COMMON_SERV CS '
      'WHERE  CS.CSISDELETE IS NULL '
      'GROUP BY 1 '
      ') AS mp ON mp.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN  '
      '(SELECT APU.PID, A1.AGID  '
      'FROM AGREEMENTS A  '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID  '
      'INNER JOIN A_SCAN A1 ON A1.AGID = A.AGID  '
      
        'WHERE A.AGID = APU.AGID AND CURRENT_DATE <= coalesce(A.AGDATECLO' +
        'SE, A.AGDATEEND) AND A.AGISDELETE IS NULL  '
      ') AS is_agrscan ON is_agrscan.PID = P.PID  '
      'LEFT OUTER JOIN DOC_DOV_LITSA DDL ON DDL.PID_POLUCH = P.PID  '
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DA' +
        'TE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATE' +
        'OUT AS DATE), CURRENT_DATE+3650) '
      
        'LEFT OUTER JOIN DETI_PODRAZD_MISC DPM ON DPM.PID = P.PID AND CUR' +
        'RENT_DATE BETWEEN CAST(dpm.DPDATEIN AS DATE) AND COALESCE(CAST(d' +
        'pm.DPDATEOUT AS DATE), CURRENT_DATE+3650) '
      'LEFT OUTER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT APU.PID, SUM(GP.GPAMOUNT) AS dolgny_zapl '
      'FROM SC_GRAFPLAT GP '
      'INNER JOIN SPEC_COND SC ON SC.SCID = GP.SCID '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE (GP.GPDATE <= CURRENT_DATE) AND SC.SCISDELETE IS NULL AND ' +
        'A.AGISDELETE IS NULL '
      'GROUP BY 1) AS DZ ON DZ.PID = P.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zaplbb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      '      AND CS.CSFORM = 0 '
      'AND CS.CSDATE >= :first_dec40513 '
      'GROUP BY 1 '
      ') AS ZBB ON ZBB.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zaplvb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE = 2 '
      '      AND CS.CSFORM = 0 '
      '      AND CS.CSDATE >= :first_dec40513 '
      'GROUP BY 1 '
      ') AS ZvB ON ZvB.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zapl_all '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      'GROUP BY 1 '
      ') AS Zall ON Zall.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN '
      '( '
      
        'SELECT P5.PID, (COALESCE(DZ1.dolgny_zapl,0) - COALESCE(ZBB1.zapl' +
        'bb,0)) AS abs_dolg '
      'FROM PEOPLE P5 '
      'LEFT OUTER JOIN '
      '( '
      'SELECT APU.PID, SUM(GP.GPAMOUNT) AS dolgny_zapl '
      'FROM SC_GRAFPLAT GP '
      'INNER JOIN SPEC_COND SC ON SC.SCID = GP.SCID '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE (GP.GPDATE <= CURRENT_DATE) AND SC.SCISDELETE IS NULL AND ' +
        'A.AGISDELETE IS NULL '
      'GROUP BY 1) AS DZ1 ON DZ1.PID = P5.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zaplbb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      'GROUP BY 1 '
      ') AS ZBB1 ON ZBB1.PID_POLUCH = P5.PID '
      
        'WHERE (COALESCE(DZ1.dolgny_zapl,0) - COALESCE(ZBB1.zaplbb,0)) > ' +
        '0 '
      ') AS AD ON AD.PID = P.PID '
      'WHERE P.PISDELETE IS NULL'
      ' ORDER BY 2,1,3')
    UpdateObject = quContrComment
    GeneratorField.Field = 'TFID'
    Left = 424
    Top = 208
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'param_distinct'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'first_dec40513'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'first_dec40513'
        ParamType = ptUnknown
      end>
    object qPeoplePLASTNAME: TIBStringField
      FieldName = 'PLASTNAME'
      Origin = '"PEOPLE"."PLASTNAME"'
      Size = 255
    end
    object qPeoplePNAME: TIBStringField
      FieldName = 'PNAME'
      Origin = '"PEOPLE"."PNAME"'
      Size = 255
    end
    object qPeoplePPATRONYMIC: TIBStringField
      FieldName = 'PPATRONYMIC'
      Origin = '"PEOPLE"."PPATRONYMIC"'
      Size = 255
    end
    object qPeoplePDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qPeoplePID: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qPeoplePP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qPeopleLET: TLargeintField
      FieldName = 'LET'
      ProviderFlags = []
    end
    object qPeopleMES: TLargeintField
      FieldName = 'MES'
      ProviderFlags = []
    end
    object qPeopleSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPeopleIS_IMAGE: TIntegerField
      FieldName = 'IS_IMAGE'
      ProviderFlags = []
    end
    object qPeopleOSN_PODR: TIBStringField
      FieldName = 'OSN_PODR'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPeopleAGR_SCAN: TIntegerField
      FieldName = 'AGR_SCAN'
      ProviderFlags = []
    end
    object qPeopleMAX_DATE_PAY: TDateField
      FieldName = 'MAX_DATE_PAY'
      ProviderFlags = []
    end
    object qPeopleDOVLITSA: TIntegerField
      FieldName = 'DOVLITSA'
      ProviderFlags = []
    end
    object qPeopleBALANCE_ALL: TIBBCDField
      DisplayLabel = #1041#1072#1083#1072#1085#1089
      FieldName = 'BALANCE_ALL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleSCDATEBEGIN: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object qPeopleSCDATEEND: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object qPeopleSCDATERASTORJ: TDateField
      FieldName = 'SCDATERASTORJ'
      Origin = '"SPEC_COND"."SCDATERASTORJ"'
    end
    object qPeopleSTNAME: TIBStringField
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 1024
    end
    object qPeopleSTTARIF: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleSCOUNT: TIntegerField
      FieldName = 'SCOUNT'
      Origin = '"SERVICES"."SCOUNT"'
    end
    object qPeopleDOLGNY_ZAPL: TIBBCDField
      FieldName = 'DOLGNY_ZAPL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleSKIDKA: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleBALANCE: TIBBCDField
      FieldName = 'BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleZAPL_ALL: TIBBCDField
      FieldName = 'ZAPL_ALL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleBAL_BANK_PERC: TIBBCDField
      FieldName = 'BAL_BANK_PERC'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeoplePID1: TIntegerField
      FieldName = 'PID1'
      Origin = '"AGR_POLUCH_USLUG"."PID"'
    end
    object qPeopleSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object qPeoplePMPCONTRNOTE: TIBStringField
      FieldName = 'PMPCONTRNOTE'
      Origin = '"P_MISC_PROP"."PMPCONTRNOTE"'
      Size = 2048
    end
    object qPeopleSC_COPY: TIntegerField
      FieldName = 'SC_COPY'
      ProviderFlags = []
    end
    object qPeopleOHR_MES: TIntegerField
      FieldName = 'OHR_MES'
      ProviderFlags = []
    end
    object qPeopleLAST_IN: TDateField
      FieldName = 'LAST_IN'
      ProviderFlags = []
    end
    object qPeopleSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qPeopleOHR_MES_ZAPR_VHOD: TIntegerField
      FieldName = 'OHR_MES_ZAPR_VHOD'
      ProviderFlags = []
    end
    object qPeopleSCTIMEENTER: TDateField
      FieldName = 'SCTIMEENTER'
      ProviderFlags = []
    end
    object qPeopleABS_DOLG: TIBBCDField
      FieldName = 'ABS_DOLG'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPeopleSCISGRAFEDIT: TIntegerField
      FieldName = 'SCISGRAFEDIT'
      ProviderFlags = []
    end
    object qPeopleSCDATE: TDateField
      FieldName = 'SCDATE'
      Origin = '"SPEC_COND"."SCDATE"'
    end
    object qPeoplePMPISDOLG: TIntegerField
      FieldName = 'PMPISDOLG'
      Origin = '"P_MISC_PROP"."PMPISDOLG"'
    end
    object qPeoplePMPDIRNOTE: TIBStringField
      FieldName = 'PMPDIRNOTE'
      Origin = '"P_MISC_PROP"."PMPDIRNOTE"'
      Size = 2048
    end
    object qPeoplePMPMANAGERNOTE: TIBStringField
      FieldName = 'PMPMANAGERNOTE'
      Origin = '"P_MISC_PROP"."PMPMANAGERNOTE"'
      Size = 2048
    end
    object qPeopleSELECT_PEOPLE: TIntegerField
      FieldName = 'SELECT_PEOPLE'
      ProviderFlags = []
    end
    object qPeopleAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"AGREEMENTS"."AGID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qPeopleAGDATEBEGIN: TDateField
      FieldName = 'AGDATEBEGIN'
      Origin = '"AGREEMENTS"."AGDATEBEGIN"'
    end
    object qPeopleAGDATEEND: TDateField
      FieldName = 'AGDATEEND'
      Origin = '"AGREEMENTS"."AGDATEEND"'
    end
    object qPeopleAGR_TYPE: TIBStringField
      FieldName = 'AGR_TYPE'
      ProviderFlags = []
      FixedChar = True
      Size = 10
    end
    object qPeoplePLASTNAME_ENGLISH: TIBStringField
      FieldName = 'PLASTNAME_ENGLISH'
      Origin = '"PEOPLE"."PLASTNAME_ENGLISH"'
      Size = 255
    end
    object qPeoplePNAME_ENGLISH: TIBStringField
      FieldName = 'PNAME_ENGLISH'
      Origin = '"PEOPLE"."PNAME_ENGLISH"'
      Size = 255
    end
  end
  object qDocuments: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qDocumentsAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT PD.*, SD.SDID, SD.SDNAME, IIF (DS.DSID IS NULL, 0, 1) AS ' +
        'ISSCAN, DS.DSIMAGE'
      'FROM P_DOCUMENTS PD'
      'INNER JOIN SYS_DIC SD ON SD.SDID = PD.DTYPE'
      'LEFT OUTER JOIN D_SCAN DS ON DS.DID = PD.DID'
      'WHERE PD.PID = :PID'
      '        AND PD.DISDELETE IS NULL')
    UpdateObject = quDocuments
    GeneratorField.Field = 'DID'
    GeneratorField.Generator = 'GEN_P_DOCUMENTS'
    Left = 56
    Top = 216
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qDocumentsDID: TIntegerField
      FieldName = 'DID'
      Origin = '"P_DOCUMENTS"."DID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qDocumentsPID: TIntegerField
      FieldName = 'PID'
      Origin = '"P_DOCUMENTS"."PID"'
    end
    object qDocumentsDTYPE: TIntegerField
      FieldName = 'DTYPE'
      Origin = '"P_DOCUMENTS"."DTYPE"'
    end
    object qDocumentsDSERIA: TIBStringField
      FieldName = 'DSERIA'
      Origin = '"P_DOCUMENTS"."DSERIA"'
      Size = 10
    end
    object qDocumentsDNUMBER: TIBStringField
      FieldName = 'DNUMBER'
      Origin = '"P_DOCUMENTS"."DNUMBER"'
      Size = 10
    end
    object qDocumentsDFROMWHO: TIBStringField
      FieldName = 'DFROMWHO'
      Origin = '"P_DOCUMENTS"."DFROMWHO"'
      Size = 255
    end
    object qDocumentsDDATE: TDateField
      FieldName = 'DDATE'
      Origin = '"P_DOCUMENTS"."DDATE"'
    end
    object qDocumentsDNOTE: TIBStringField
      FieldName = 'DNOTE'
      Origin = '"P_DOCUMENTS"."DNOTE"'
      Size = 255
    end
    object qDocumentsDUSERENTER: TIBStringField
      FieldName = 'DUSERENTER'
      Origin = '"P_DOCUMENTS"."DUSERENTER"'
      Size = 40
    end
    object qDocumentsDTIMEENTER: TDateTimeField
      FieldName = 'DTIMEENTER'
      Origin = '"P_DOCUMENTS"."DTIMEENTER"'
    end
    object qDocumentsDUSEREDIT: TIBStringField
      FieldName = 'DUSEREDIT'
      Origin = '"P_DOCUMENTS"."DUSEREDIT"'
      Size = 40
    end
    object qDocumentsDTIMEEDIT: TDateTimeField
      FieldName = 'DTIMEEDIT'
      Origin = '"P_DOCUMENTS"."DTIMEEDIT"'
    end
    object qDocumentsISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qDocumentsDISDELETE: TIntegerField
      FieldName = 'DISDELETE'
      Origin = '"P_DOCUMENTS"."DISDELETE"'
    end
    object qDocumentsSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qDocumentsDSIMAGE: TBlobField
      FieldName = 'DSIMAGE'
      Origin = '"D_SCAN"."DSIMAGE"'
      ProviderFlags = [pfInUpdate]
      Size = 8
    end
    object qDocumentsDMAINDOC: TIntegerField
      FieldName = 'DMAINDOC'
      Origin = '"P_DOCUMENTS"."DMAINDOC"'
    end
  end
  object dsDocuments: TDataSource
    DataSet = qDocuments
    Left = 32
    Top = 216
  end
  object quDocuments: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  DID,'
      '  PID,'
      '  DMAINDOC,'
      '  DTYPE,'
      '  DSERIA,'
      '  DNUMBER,'
      '  DFROMWHO,'
      '  DDATE,'
      '  DNOTE,'
      '  DISDELETE,'
      '  DUSERENTER,'
      '  DTIMEENTER,'
      '  DUSEREDIT,'
      '  DTIMEEDIT,'
      '  SDID,'
      '  SDNAME,'
      '  ISSCAN,'
      '  DSIMAGE'
      'from P_DOCUMENTS '
      'where'
      '  DID = :DID')
    ModifySQL.Strings = (
      'update P_DOCUMENTS'
      'set'
      '  DDATE = :DDATE,'
      '  DFROMWHO = :DFROMWHO,'
      '  DID = :DID,'
      '  DISDELETE = :DISDELETE,'
      '  DMAINDOC = :DMAINDOC,'
      '  DNOTE = :DNOTE,'
      '  DNUMBER = :DNUMBER,'
      '  DSERIA = :DSERIA,'
      '  DTIMEEDIT = :DTIMEEDIT,'
      '  DTIMEENTER = :DTIMEENTER,'
      '  DTYPE = :DTYPE,'
      '  DUSEREDIT = :DUSEREDIT,'
      '  DUSERENTER = :DUSERENTER,'
      '  PID = :PID'
      'where'
      '  DID = :OLD_DID')
    InsertSQL.Strings = (
      'insert into P_DOCUMENTS'
      
        '  (DDATE, DFROMWHO, DID, DISDELETE, DMAINDOC, DNOTE, DNUMBER, DS' +
        'ERIA, DTIMEEDIT, '
      '   DTIMEENTER, DTYPE, DUSEREDIT, DUSERENTER, PID)'
      'values'
      
        '  (:DDATE, :DFROMWHO, :DID, :DISDELETE, :DMAINDOC, :DNOTE, :DNUM' +
        'BER, :DSERIA, '
      
        '   :DTIMEEDIT, :DTIMEENTER, :DTYPE, :DUSEREDIT, :DUSERENTER, :PI' +
        'D)')
    DeleteSQL.Strings = (
      'update P_DOCUMENTS'
      'set'
      '  DISDELETE = 1'
      'where'
      '  DID = :OLD_DID')
    Left = 80
    Top = 216
  end
  object dsVizit: TDataSource
    DataSet = qVizit
    Left = 1088
    Top = 592
  end
  object qVizit: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT PV.*, (COALESCE(P_IN.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P_IN.P' +
        'NAME,'#39' '#39')) AS PP_IN,'
      
        '    (COALESCE(P_OUT.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P_OUT.PNAME,'#39' ' +
        #39')) AS PP_OUT,'
      '    CASE PV.PVSCANRESULT_IN'
      '    WHEN 1 THEN '#39#1054#1090#1087#1077#1095'. '#1080' '#1082#1072#1088#1090#1072#39
      '    WHEN 2 THEN '#39#1050#1072#1088#1090#1072#39
      '    WHEN 3 THEN '#39#1054#1090#1087#1077#1095#1072#1090#1086#1082#39
      '    WHEN 4 THEN '#39#1056#1091#1095#1085#1086#1081#39
      '    END AS scan_in,'
      '    CASE PV.PVSCANRESULT_OUT'
      '    WHEN 1 THEN '#39#1054#1090#1087#1077#1095'. '#1080' '#1082#1072#1088#1090#1072#39
      '    WHEN 2 THEN '#39#1050#1072#1088#1090#1072#39
      '    WHEN 3 THEN '#39#1054#1090#1087#1077#1095#1072#1090#1086#1082#39
      '    WHEN 4 THEN '#39#1056#1091#1095#1085#1086#1081#39
      '    END AS scan_out,'
      
        '    COALESCE(P_ex.PLASTNAME||'#39' '#39'||P_ex.PNAME, te.USERENTER) AS u' +
        'ser_extra,'
      '    te.NOTE,'
      
        '    DATEDIFF(HOUR FROM pv.pvtime_in TO COALESCE(pv.pvtime_out, C' +
        'URRENT_TIMESTAMP)) AS h,'
      '    sel.prichina'
      'FROM P_VIZIT PV'
      'LEFT OUTER JOIN USERS U_IN ON U_IN.USNAME = PV.PVUSERENTER'
      'LEFT OUTER JOIN PEOPLE P_IN ON P_IN.PID = U_IN.PID'
      'LEFT OUTER JOIN USERS U_OUT ON U_OUT.USNAME = PV.PVUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P_OUT ON P_OUT.PID = U_OUT.PID'
      'LEFT OUTER JOIN PEOPLE P_ex ON P_ex.PID = PV.PVPIDEXTRA'
      'LEFT OUTER JOIN'
      '('
      'SELECT SA.PVID, LIST(SD.SDNAME, '#39', '#39') AS prichina'
      'FROM SECURITY_ACESSDENIED SA'
      'INNER JOIN SYS_DIC SD ON SD.SDID = SA.SDID'
      'GROUP BY 1'
      ') AS sel ON sel.pvid = PV.PVID'
      'LEFT OUTER JOIN KPP_TEMP_ENTER te ON te.PVID = pv.PVID'
      'WHERE PV.PID = :PID'
      'order by 4 desc')
    GeneratorField.Field = 'TFID'
    Left = 1120
    Top = 592
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qVizitPVID: TIntegerField
      FieldName = 'PVID'
      Origin = '"P_VIZIT"."PVID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qVizitPID: TIntegerField
      FieldName = 'PID'
      Origin = '"P_VIZIT"."PID"'
    end
    object qVizitPVTARGET: TIntegerField
      FieldName = 'PVTARGET'
      Origin = '"P_VIZIT"."PVTARGET"'
    end
    object qVizitPVTIME_IN: TDateTimeField
      FieldName = 'PVTIME_IN'
      Origin = '"P_VIZIT"."PVTIME_IN"'
    end
    object qVizitPVTIME_OUT: TDateTimeField
      FieldName = 'PVTIME_OUT'
      Origin = '"P_VIZIT"."PVTIME_OUT"'
    end
    object qVizitPVPRIZNAK_IN: TIntegerField
      FieldName = 'PVPRIZNAK_IN'
      Origin = '"P_VIZIT"."PVPRIZNAK_IN"'
    end
    object qVizitPVPRIZNAK_OUT: TIntegerField
      FieldName = 'PVPRIZNAK_OUT'
      Origin = '"P_VIZIT"."PVPRIZNAK_OUT"'
    end
    object qVizitPVNOTE: TIBStringField
      FieldName = 'PVNOTE'
      Origin = '"P_VIZIT"."PVNOTE"'
      Size = 255
    end
    object qVizitPVUSERENTER: TIBStringField
      FieldName = 'PVUSERENTER'
      Origin = '"P_VIZIT"."PVUSERENTER"'
      Size = 40
    end
    object qVizitPVTIMEENTER: TDateTimeField
      FieldName = 'PVTIMEENTER'
      Origin = '"P_VIZIT"."PVTIMEENTER"'
    end
    object qVizitPVUSEREDIT: TIBStringField
      FieldName = 'PVUSEREDIT'
      Origin = '"P_VIZIT"."PVUSEREDIT"'
      Size = 40
    end
    object qVizitPVTIMEEDIT: TDateTimeField
      FieldName = 'PVTIMEEDIT'
      Origin = '"P_VIZIT"."PVTIMEEDIT"'
    end
    object qVizitPP_IN: TIBStringField
      FieldName = 'PP_IN'
      ProviderFlags = []
      Size = 511
    end
    object qVizitPP_OUT: TIBStringField
      FieldName = 'PP_OUT'
      ProviderFlags = []
      Size = 511
    end
    object qVizitSCAN_IN: TIBStringField
      FieldName = 'SCAN_IN'
      ProviderFlags = []
      FixedChar = True
      Size = 14
    end
    object qVizitSCAN_OUT: TIBStringField
      FieldName = 'SCAN_OUT'
      ProviderFlags = []
      FixedChar = True
      Size = 14
    end
    object qVizitUSER_EXTRA: TIBStringField
      FieldName = 'USER_EXTRA'
      ProviderFlags = []
      Size = 511
    end
    object qVizitH: TLargeintField
      FieldName = 'H'
      ProviderFlags = []
    end
    object qVizitPRICHINA: TMemoField
      FieldName = 'PRICHINA'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
    object qVizitNOTE: TIBStringField
      FieldName = 'NOTE'
      Origin = '"KPP_TEMP_ENTER"."NOTE"'
      Size = 255
    end
  end
  object dsPhoto: TDataSource
    DataSet = qPhoto
    Left = 16
    Top = 584
  end
  object qPhoto: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qPhotoAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT PP.*'
      'from P_PHOTOS PP'
      'WHERE PP.PID = :pid')
    UpdateObject = quPhoto
    Left = 48
    Top = 568
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qPhotoPID: TIntegerField
      FieldName = 'PID'
      Origin = '"P_PHOTOS"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qPhotoPPIMAGE: TBlobField
      FieldName = 'PPIMAGE'
      Origin = '"P_PHOTOS"."PPIMAGE"'
      ProviderFlags = [pfInUpdate]
      Size = 8
    end
    object qPhotoPPNOTE: TIBStringField
      FieldName = 'PPNOTE'
      Origin = '"P_PHOTOS"."PPNOTE"'
      Size = 255
    end
    object qPhotoPPUSERENTER: TIBStringField
      FieldName = 'PPUSERENTER'
      Origin = '"P_PHOTOS"."PPUSERENTER"'
      Size = 40
    end
    object qPhotoPPTIMEENTER: TDateTimeField
      FieldName = 'PPTIMEENTER'
      Origin = '"P_PHOTOS"."PPTIMEENTER"'
    end
    object qPhotoPPUSEREDIT: TIBStringField
      FieldName = 'PPUSEREDIT'
      Origin = '"P_PHOTOS"."PPUSEREDIT"'
      Size = 40
    end
    object qPhotoPPTIMEEDIT: TDateTimeField
      FieldName = 'PPTIMEEDIT'
      Origin = '"P_PHOTOS"."PPTIMEEDIT"'
    end
  end
  object quPhoto: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  PID,'
      '  PPIMAGE,'
      '  PPNOTE,'
      '  PPUSERENTER,'
      '  PPTIMEENTER,'
      '  PPUSEREDIT,'
      '  PPTIMEEDIT'
      'from P_PHOTOS '
      'where'
      '  PID = :PID')
    ModifySQL.Strings = (
      'update P_PHOTOS'
      'set'
      '  PID = :PID,'
      '  PPIMAGE = :PPIMAGE,'
      '  PPNOTE = :PPNOTE,'
      '  PPTIMEEDIT = :PPTIMEEDIT,'
      '  PPTIMEENTER = :PPTIMEENTER,'
      '  PPUSEREDIT = :PPUSEREDIT,'
      '  PPUSERENTER = :PPUSERENTER'
      'where'
      '  PID = :OLD_PID')
    InsertSQL.Strings = (
      'insert into P_PHOTOS'
      
        '  (PID, PPIMAGE, PPNOTE, PPTIMEEDIT, PPTIMEENTER, PPUSEREDIT, PP' +
        'USERENTER)'
      'values'
      
        '  (:PID, :PPIMAGE, :PPNOTE, :PPTIMEEDIT, :PPTIMEENTER, :PPUSERED' +
        'IT, :PPUSERENTER)')
    DeleteSQL.Strings = (
      'delete from P_PHOTOS'
      'where'
      '  PID = :OLD_PID')
    Left = 80
    Top = 568
  end
  object SD1: TSaveDialog
    InitialDir = 'c:\'
    Options = [ofOverwritePrompt, ofHideReadOnly, ofEnableSizing]
    Left = 1112
    Top = 216
  end
  object dsAgr: TDataSource
    DataSet = qAgr
    Left = 272
    Top = 536
  end
  object qAgr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    BeforePost = qAgrBeforePost
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT UN.*, trim(LIST(UN.podp, '#39', '#39')) as list '
      'FROM '
      '( '
      
        'SELECT A.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P_' +
        'res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT, '
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH, '
      '     SD.SDNAME AS FORMA, '
      
        '('#39', '#1087#1088#1086#1078#1080#1074#1072#1102#1097#1077#1081'('#1075#1086') '#1087#1086' '#1072#1076#1088#1077#1089#1091': '#39'||COALESCE(ci.CIKLADRADRESS||'#39' ,' +
        ' '#39'||ci.CIVALUE, ci.CIVALUE)) AS adress,'
      'CASE a.AGPODRTYPE'
      'WHEN 0 THEN '#39#1044'/'#1089#39
      'WHEN 1 THEN '#39#1043#1080#1084#1085#1072#1079'.'#39
      'WHEN 2 THEN '#39#1057#1088'. '#1096#1082'.'#39
      'WHEN 3 THEN '#39#1057#1090'. '#1096#1082'.'#39
      'WHEN 4 THEN '#39#1051#1072#1075#1077#1088#1100#39
      'END AS podrazd,'
      
        '    CAST( trim(LIST(DISTINCT (P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||CO' +
        'ALESCE(P.PPATRONYMIC,'#39' '#39')), '#39', '#39')) AS VARCHAR(2048)) AS podp '
      'FROM AGREEMENTS A '
      'INNER JOIN '
      '( '
      'SELECT A.AGID '
      'FROM AGREEMENTS A '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID '
      'WHERE APU.PID = :PID '
      'UNION '
      'SELECT A.AGID '
      'FROM AGREEMENTS A '
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID '
      'WHERE AP.PID = :PID '
      ') AS AG1 ON AG1.AGID = A.AGID '
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID '
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID '
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID '
      'INNER JOIN PEOPLE P ON P.PID = AP.PID '
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE '
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID '
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = APU.PID AND CI.CITYPE' +
        ' = 1153 '
      'WHERE a.AGISDELETE IS NULL '
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2,23,24, 25'
      'UNION '
      
        'SELECT A.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P_' +
        'res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT, '
      '     IIF (S.AGID IS NULL, 0, 1) AS ISSCAN, P_res.PDATEBIRTH, '
      '     SD.SDNAME AS FORMA, '
      '     CASE a.AGPODRTYPE'
      'WHEN 0 THEN '#39#1044'/'#1089#39
      'WHEN 1 THEN '#39#1043#1080#1084#1085#1072#1079'.'#39
      'WHEN 2 THEN '#39#1057#1088'. '#1096#1082'.'#39
      'WHEN 3 THEN '#39#1057#1090'. '#1096#1082'.'#39
      'WHEN 4 THEN '#39#1051#1072#1075#1077#1088#1100#39
      'END AS podrazd,'
      
        '('#39', '#1087#1088#1086#1078#1080#1074#1072#1102#1097#1077#1081'('#1075#1086') '#1087#1086' '#1072#1076#1088#1077#1089#1091': '#39'||COALESCE(k.NAME||'#39' , '#39'||ks.NAM' +
        'E||'#39' , '#39'||ci.CIVALUE, ci.CIVALUE)) AS adress, '
      ' AP.ID_JURIDICAL_FACE'
      'FROM AGREEMENTS A '
      'INNER JOIN '
      '( '
      'SELECT A.AGID '
      'FROM AGREEMENTS A '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID '
      'WHERE APU.PID = :PID '
      'UNION '
      'SELECT A.AGID '
      'FROM AGREEMENTS A '
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID '
      'WHERE AP.PID = :PID '
      ') AS AG1 ON AG1.AGID = A.AGID '
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID '
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = APU.PID '
      
        'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID AND AP.POTYPE = ' +
        '1 '
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = A.AGFORMTYPE '
      'LEFT OUTER JOIN A_SCAN S ON S.AGID = A.AGID '
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = APU.PID AND CI.CITYPE' +
        ' = 1153 '
      'LEFT OUTER JOIN KLADR_STREET_MO ks ON ks.KSID = CI.KSID '
      'LEFT OUTER JOIN KLADR_MO k ON k.KID = ci.KID  '
      'WHERE a.AGISDELETE IS NULL '
      ') AS UN '
      
        'GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,2' +
        '2,23,24,25, 26'
      ' order by UN.AGDATEEND DESC')
    UpdateObject = quAgr
    GeneratorField.Field = 'AGID'
    GeneratorField.Generator = 'GEN_AGREEMENTS'
    Left = 312
    Top = 552
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qAgrAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"AGREEMENTS"."AGID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qAgrAGNUM_N: TIntegerField
      FieldName = 'AGNUM_N'
      Origin = '"AGREEMENTS"."AGNUM_N"'
    end
    object qAgrAGNUM: TIBStringField
      FieldName = 'AGNUM'
      Origin = '"AGREEMENTS"."AGNUM"'
      Size = 40
    end
    object qAgrAGDATE: TDateField
      FieldName = 'AGDATE'
      Origin = '"AGREEMENTS"."AGDATE"'
    end
    object qAgrAGDATEEND: TDateField
      FieldName = 'AGDATEEND'
      Origin = '"AGREEMENTS"."AGDATEEND"'
    end
    object qAgrAGFORMTYPE: TIntegerField
      FieldName = 'AGFORMTYPE'
      Origin = '"AGREEMENTS"."AGFORMTYPE"'
    end
    object qAgrAGNOTE: TIBStringField
      FieldName = 'AGNOTE'
      Origin = '"AGREEMENTS"."AGNOTE"'
      Size = 255
    end
    object qAgrAGDATECLOSE: TDateField
      FieldName = 'AGDATECLOSE'
      Origin = '"AGREEMENTS"."AGDATECLOSE"'
    end
    object qAgrAGNOTECLOSE: TIBStringField
      FieldName = 'AGNOTECLOSE'
      Origin = '"AGREEMENTS"."AGNOTECLOSE"'
      Size = 255
    end
    object qAgrAGUSERENTER: TIBStringField
      FieldName = 'AGUSERENTER'
      Origin = '"AGREEMENTS"."AGUSERENTER"'
      Size = 40
    end
    object qAgrAGTIMEENTER: TDateTimeField
      FieldName = 'AGTIMEENTER'
      Origin = '"AGREEMENTS"."AGTIMEENTER"'
    end
    object qAgrAGUSEREDIT: TIBStringField
      FieldName = 'AGUSEREDIT'
      Origin = '"AGREEMENTS"."AGUSEREDIT"'
      Size = 40
    end
    object qAgrAGTIMEEDIT: TDateTimeField
      FieldName = 'AGTIMEEDIT'
      Origin = '"AGREEMENTS"."AGTIMEEDIT"'
    end
    object qAgrAGISDELETE: TIntegerField
      FieldName = 'AGISDELETE'
      Origin = '"AGREEMENTS"."AGISDELETE"'
    end
    object qAgrP_RECIPIENT: TIBStringField
      FieldName = 'P_RECIPIENT'
      ProviderFlags = []
      Size = 767
    end
    object qAgrISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qAgrPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qAgrFORMA: TIBStringField
      FieldName = 'FORMA'
      ProviderFlags = []
      Size = 255
    end
    object qAgrLIST: TMemoField
      FieldName = 'LIST'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
    object qAgrAGUSERREGISTER: TIBStringField
      FieldName = 'AGUSERREGISTER'
      Origin = '"AGREEMENTS"."AGUSERREGISTER"'
      Size = 40
    end
    object qAgrAGDATEREGISTER: TDateTimeField
      FieldName = 'AGDATEREGISTER'
      Origin = '"AGREEMENTS"."AGDATEREGISTER"'
    end
    object qAgrAGISNEEDRESIGN: TIntegerField
      FieldName = 'AGISNEEDRESIGN'
      Origin = '"AGREEMENTS"."AGISNEEDRESIGN"'
    end
    object qAgrAGPODRTYPE: TIntegerField
      FieldName = 'AGPODRTYPE'
      Origin = '"AGREEMENTS"."AGPODRTYPE"'
    end
    object qAgrAGDATEBEGIN: TDateField
      FieldName = 'AGDATEBEGIN'
      ProviderFlags = []
    end
    object qAgrPODP: TIBStringField
      FieldName = 'PODP'
      ProviderFlags = []
      Size = 2048
    end
    object qAgrADRESS: TIBStringField
      FieldName = 'ADRESS'
      ProviderFlags = []
      Size = 284
    end
    object qAgrPODRAZD: TIBStringField
      FieldName = 'PODRAZD'
      ProviderFlags = []
      Size = 450
    end
  end
  object quAgr: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  AGID,'
      '  AGNUM_N,'
      '  AGNUM,'
      '  AGUSERREGISTER,'
      '  AGDATEREGISTER,'
      '  AGDATE,'
      '  AGDATEBEGIN,'
      '  AGDATEEND,'
      '  AGFORMTYPE,'
      '  AGNOTE,'
      '  AGDATECLOSE,'
      '  AGNOTECLOSE,'
      '  AGISNEEDRESIGN,'
      '  AGPODRTYPE,'
      '  AGISDELETE,'
      '  AGUSERENTER,'
      '  AGTIMEENTER,'
      '  AGUSEREDIT,'
      '  AGTIMEEDIT,'
      '  P_RECIPIENT,'
      '  ISSCAN,'
      '  PDATEBIRTH,'
      '  FORMA,'
      '  PODP,'
      '  LIST'
      'from AGREEMENTS '
      'where'
      '  AGID = :AGID')
    ModifySQL.Strings = (
      'update AGREEMENTS'
      'set'
      '  AGDATE = :AGDATE,'
      '  AGDATEBEGIN = :AGDATEBEGIN,'
      '  AGDATECLOSE = :AGDATECLOSE,'
      '  AGDATEEND = :AGDATEEND,'
      '  AGDATEREGISTER = :AGDATEREGISTER,'
      '  AGFORMTYPE = :AGFORMTYPE,'
      '  AGID = :AGID,'
      '  AGISDELETE = :AGISDELETE,'
      '  AGISNEEDRESIGN = :AGISNEEDRESIGN,'
      '  AGNOTE = :AGNOTE,'
      '  AGNOTECLOSE = :AGNOTECLOSE,'
      '  AGNUM = :AGNUM,'
      '  AGNUM_N = :AGNUM_N,'
      '  AGPODRTYPE = :AGPODRTYPE,'
      '  AGUSERREGISTER = :AGUSERREGISTER'
      'where'
      '  AGID = :OLD_AGID')
    InsertSQL.Strings = (
      'insert into AGREEMENTS'
      
        '  (AGDATE, AGDATEBEGIN, AGDATECLOSE, AGDATEEND, AGDATEREGISTER, ' +
        'AGFORMTYPE, '
      
        '   AGID, AGISDELETE, AGISNEEDRESIGN, AGNOTE, AGNOTECLOSE, AGNUM,' +
        ' AGNUM_N, '
      '   AGPODRTYPE,  AGUSERREGISTER)'
      'values'
      
        '  (:AGDATE, :AGDATEBEGIN, :AGDATECLOSE, :AGDATEEND, :AGDATEREGIS' +
        'TER, :AGFORMTYPE, '
      
        '   :AGID, :AGISDELETE, :AGISNEEDRESIGN, :AGNOTE, :AGNOTECLOSE, :' +
        'AGNUM, '
      '   :AGNUM_N, :AGPODRTYPE,'
      '   :AGUSERREGISTER)')
    DeleteSQL.Strings = (
      'update AGREEMENTS'
      'set'
      '  AGISDELETE = 1'
      'where'
      '  AGID = :OLD_AGID')
    Left = 347
    Top = 552
  end
  object qChekNumAgr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT COUNT(AG.AGID) AS AGNUM_N'
      'FROM AGREEMENTS AG'
      'WHERE CAST(AG.AGTIMEENTER AS DATE) = CURRENT_DATE')
    Left = 339
    Top = 672
    object qChekNumAgrAGNUM_N: TIntegerField
      FieldName = 'AGNUM_N'
      ProviderFlags = []
    end
  end
  object qResetGen: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'ALTER SEQUENCE GEN_AGREEMENTS_DAY RESTART WITH 0')
    Left = 307
    Top = 680
  end
  object dsSpecCond: TDataSource
    DataSet = qSpecCond
    OnDataChange = dsSpecCondDataChange
    Left = 264
    Top = 728
  end
  object qSpecCond: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterClose = qSpecCondAfterClose
    AfterInsert = qSpecCondAfterInsert
    AfterOpen = qSpecCondAfterOpen
    BeforePost = qAgrBeforePost
    CachedUpdates = True
    DataSource = dsAgr
    SQL.Strings = (
      
        'SELECT SC.*, IIF (S.SCID IS NULL, 0, 1) AS ISSCAN, SD.SDNAME AS ' +
        'actualn, '
      
        '    STP.*, SER.*, IIF (stp.STPERIODOPLATY = 1,'#39#1059#1095#1077#1073#1085#1099#1081' '#1090#1088#1080#1084#1077#1089#1090#1088'.' +
        #39', '#39#1052#1077#1089#1103#1094'.'#39') AS minperiod, SD_edizmer.SDNAME AS edizme, '
      
        '    CAST(IIF (A.AGPODRTYPE = 0, '#39#1042#1086#1089#1087#1080#1090#1072#1085#1085#1080#1082#39', '#39#1059#1095#1077#1085#1080#1082#39') AS VARC' +
        'HAR(20)) AS vospit, '
      '    CASE STP.STTYPE '
      '       WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39' '
      '       WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39' '
      '       WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39' '
      '    END AS tip, '
      '       cast( IIF (STP.STTYPE <> 0, '
      '       CASE STP.STPERIODOPLATY '
      '       WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39' '
      '       WHEN 1 THEN '#39#1059#1095#1077#1073#1085#1099#1081' '#1090#1088#1080#1084#1077#1089#1090#1088#39' '
      '       END, '#39#1053#1077#1090#39') as varchar(50)) AS period, '
      
        '    SCPD.dolgny_zapl, (STP.STTARIF - SC.SCTARIFWITHDISCOUNT) AS ' +
        'skidka, '
      
        '    p1.PLASTNAME||'#39' '#39'||SUBSTRING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||' +
        ' '
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'. '#39','#39' '#39') AS au' +
        'tor,'
      
        'IIF (coalesce(SC.SCTIMEEDIT, current_timestamp - 36500) > coales' +
        'ce(SER.STIMEEDIT, current_timestamp - 36500), (p3.PLASTNAME||'#39' '#39 +
        '||SUBSTRING(p3.PNAME FROM 1 FOR 1 )||'#39'. '#39'|| '
      
        'COALESCE(SUBSTRING(p3.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39')), (p2.' +
        'PLASTNAME||'#39' '#39'||SUBSTRING(p2.PNAME FROM 1 FOR 1 )||'#39'. '#39'|| '
      
        'COALESCE(SUBSTRING(p2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39'))) AS e' +
        'dit_user, '
      'EXTRACT (YEAR FROM SC.SCDATEEND) AS SCY, '
      
        'IIF (coalesce(SC.SCTIMEEDIT, current_timestamp - 36500) > coales' +
        'ce(SER.STIMEEDIT, current_timestamp - 36500), SC.SCTIMEEDIT, SER' +
        '.STIMEEDIT) AS time_edit, COALESCE(SC.SCAPPROVED,1) AS SCAPPROVE' +
        'D1 '
      'FROM SPEC_COND SC '
      'LEFT OUTER JOIN SERVICES SER ON SER.SCID = SC.SCID '
      'LEFT OUTER JOIN SERVICES_TYPE STP ON STP.STID = SER.STID '
      'LEFT OUTER JOIN SC_SCAN S ON S.SCID = SC.SCID '
      'LEFT OUTER JOIN SCACTUALN SCA ON SCA.SCID = SC.SCID '
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = SCA.SDID '
      
        'LEFT OUTER JOIN SYS_DIC SD_edizmer ON SD_edizmer.SDID = STP.STED' +
        'IZMER '
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      'LEFT OUTER JOIN USERS U ON U.USNAME = SC.SCUSERENTER '
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID '
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = SER.SUSEREDIT '
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U1.PID '
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = SC.SCUSEREDIT '
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U2.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT GP.SCID, SUM(GP.GPAMOUNT) AS dolgny_zapl '
      'FROM SC_GRAFPLAT GP '
      'WHERE (GP.GPDATE < CURRENT_DATE) '
      'GROUP BY 1) AS SCPD ON SCPD.SCID = SC.SCID '
      'WHERE SC.AGID = :AGID '
      'AND SC.SCISDELETE IS NULL '
      'order by SC.SCID')
    UpdateObject = quSpecCond
    GeneratorField.Field = 'SCID'
    GeneratorField.Generator = 'GEN_SPEC_COND'
    Left = 296
    Top = 728
    ParamData = <
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qSpecCondSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qSpecCondSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object qSpecCondAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"SPEC_COND"."AGID"'
      Required = True
    end
    object qSpecCondSCNUMBER: TIBStringField
      FieldName = 'SCNUMBER'
      Origin = '"SPEC_COND"."SCNUMBER"'
      Size = 40
    end
    object qSpecCondSCDATE: TDateField
      FieldName = 'SCDATE'
      Origin = '"SPEC_COND"."SCDATE"'
    end
    object qSpecCondSCDATEEND: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object qSpecCondSCNOTE: TIBStringField
      FieldName = 'SCNOTE'
      Origin = '"SPEC_COND"."SCNOTE"'
      Size = 255
    end
    object qSpecCondSCUSERENTER: TIBStringField
      FieldName = 'SCUSERENTER'
      Origin = '"SPEC_COND"."SCUSERENTER"'
      Size = 40
    end
    object qSpecCondSCTIMEENTER: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object qSpecCondSCUSEREDIT: TIBStringField
      FieldName = 'SCUSEREDIT'
      Origin = '"SPEC_COND"."SCUSEREDIT"'
      Size = 40
    end
    object qSpecCondSCTIMEEDIT: TDateTimeField
      FieldName = 'SCTIMEEDIT'
      Origin = '"SPEC_COND"."SCTIMEEDIT"'
    end
    object qSpecCondSCISDELETE: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object qSpecCondISSCAN: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object qSpecCondSCDISCOUNTAUTORISATION: TIBStringField
      FieldName = 'SCDISCOUNTAUTORISATION'
      Origin = '"SPEC_COND"."SCDISCOUNTAUTORISATION"'
      Size = 40
    end
    object qSpecCondSCDATEREGISTER: TDateTimeField
      FieldName = 'SCDATEREGISTER'
      Origin = '"SPEC_COND"."SCDATEREGISTER"'
    end
    object qSpecCondSCUSERREGISTER: TIBStringField
      FieldName = 'SCUSERREGISTER'
      Origin = '"SPEC_COND"."SCUSERREGISTER"'
      Size = 40
    end
    object qSpecCondSCDISCOUNT: TIBBCDField
      FieldName = 'SCDISCOUNT'
      Origin = '"SPEC_COND"."SCDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCTYPEOFDISCOUNT: TIntegerField
      FieldName = 'SCTYPEOFDISCOUNT'
      Origin = '"SPEC_COND"."SCTYPEOFDISCOUNT"'
    end
    object qSpecCondSCISNEEDRESIGN: TIntegerField
      FieldName = 'SCISNEEDRESIGN'
      Origin = '"SPEC_COND"."SCISNEEDRESIGN"'
    end
    object qSpecCondSCDISCOUNTNOTE: TIBStringField
      FieldName = 'SCDISCOUNTNOTE'
      Origin = '"SPEC_COND"."SCDISCOUNTNOTE"'
      Size = 255
    end
    object qSpecCondACTUALN: TIBStringField
      FieldName = 'ACTUALN'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSpecCondSCTYPEOFDISC: TIntegerField
      FieldName = 'SCTYPEOFDISC'
      Origin = '"SPEC_COND"."SCTYPEOFDISC"'
    end
    object qSpecCondSTID: TIntegerField
      FieldName = 'STID'
      Origin = '"SERVICES_TYPE"."STID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qSpecCondSTNAME: TIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object qSpecCondSTTYPE: TIntegerField
      FieldName = 'STTYPE'
      Origin = '"SERVICES_TYPE"."STTYPE"'
    end
    object qSpecCondSTEDIZMER: TIntegerField
      FieldName = 'STEDIZMER'
      Origin = '"SERVICES_TYPE"."STEDIZMER"'
    end
    object qSpecCondSTDESCR: TIBStringField
      FieldName = 'STDESCR'
      Origin = '"SERVICES_TYPE"."STDESCR"'
      Size = 2048
    end
    object qSpecCondSTTARIF: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSTDATEBEGIN: TDateField
      FieldName = 'STDATEBEGIN'
      Origin = '"SERVICES_TYPE"."STDATEBEGIN"'
    end
    object qSpecCondSTDATEEND: TDateField
      FieldName = 'STDATEEND'
      Origin = '"SERVICES_TYPE"."STDATEEND"'
    end
    object qSpecCondSTTIME: TTimeField
      FieldName = 'STTIME'
      Origin = '"SERVICES_TYPE"."STTIME"'
    end
    object qSpecCondSTPODRTYPE: TIntegerField
      FieldName = 'STPODRTYPE'
      Origin = '"SERVICES_TYPE"."STPODRTYPE"'
    end
    object qSpecCondSTNOTE: TIBStringField
      FieldName = 'STNOTE'
      Origin = '"SERVICES_TYPE"."STNOTE"'
      Size = 255
    end
    object qSpecCondSTISARCHIVE: TIntegerField
      FieldName = 'STISARCHIVE'
      Origin = '"SERVICES_TYPE"."STISARCHIVE"'
    end
    object qSpecCondSTISDELETE: TIntegerField
      FieldName = 'STISDELETE'
      Origin = '"SERVICES_TYPE"."STISDELETE"'
    end
    object qSpecCondSTUSERENTER: TIBStringField
      FieldName = 'STUSERENTER'
      Origin = '"SERVICES_TYPE"."STUSERENTER"'
      Size = 40
    end
    object qSpecCondSTTIMEENTER: TDateTimeField
      FieldName = 'STTIMEENTER'
      Origin = '"SERVICES_TYPE"."STTIMEENTER"'
    end
    object qSpecCondSTUSEREDIT: TIBStringField
      FieldName = 'STUSEREDIT'
      Origin = '"SERVICES_TYPE"."STUSEREDIT"'
      Size = 40
    end
    object qSpecCondSTTIMEEDIT: TDateTimeField
      FieldName = 'STTIMEEDIT'
      Origin = '"SERVICES_TYPE"."STTIMEEDIT"'
    end
    object qSpecCondSCDATEBEGIN: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object qSpecCondSNOTE: TIBStringField
      FieldName = 'SNOTE'
      Origin = '"SERVICES"."SNOTE"'
      Size = 255
    end
    object qSpecCondSTIMEBEGIN: TTimeField
      FieldName = 'STIMEBEGIN'
      Origin = '"SERVICES"."STIMEBEGIN"'
    end
    object qSpecCondSTIMEEND: TTimeField
      FieldName = 'STIMEEND'
      Origin = '"SERVICES"."STIMEEND"'
    end
    object qSpecCondSCMINPERIOD: TIntegerField
      FieldName = 'SCMINPERIOD'
      Origin = '"SPEC_COND"."SCMINPERIOD"'
    end
    object qSpecCondSCOUNT: TIntegerField
      FieldName = 'SCOUNT'
      Origin = '"SERVICES"."SCOUNT"'
    end
    object qSpecCondEDIZME: TIBStringField
      FieldName = 'EDIZME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSpecCondSCTARIF: TIBBCDField
      FieldName = 'SCTARIF'
      Origin = '"SPEC_COND"."SCTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCAMOUNT: TIBBCDField
      FieldName = 'SCAMOUNT'
      Origin = '"SPEC_COND"."SCAMOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object qSpecCondSCDATARASCH: TIntegerField
      FieldName = 'SCDATARASCH'
      Origin = '"SPEC_COND"."SCDATARASCH"'
    end
    object qSpecCondVOSPIT: TIBStringField
      FieldName = 'VOSPIT'
      ProviderFlags = []
      FixedChar = True
      Size = 11
    end
    object qSpecCondSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"SERVICES_TYPE"."SDID"'
    end
    object qSpecCondTIP: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 9
    end
    object qSpecCondSKIDKA: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSpecCondAUTOR: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object qSpecCondSCDATERASTORJ: TDateField
      FieldName = 'SCDATERASTORJ'
      Origin = '"SPEC_COND"."SCDATERASTORJ"'
    end
    object qSpecCondEDIT_USER: TIBStringField
      FieldName = 'EDIT_USER'
      ProviderFlags = []
      Size = 769
    end
    object qSpecCondMINPERIOD: TIBStringField
      FieldName = 'MINPERIOD'
      ProviderFlags = []
      FixedChar = True
      Size = 22
    end
    object qSpecCondPOID: TIntegerField
      FieldName = 'POID'
      Origin = '"SPEC_COND"."POID"'
    end
    object qSpecCondPERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 50
    end
    object qSpecCondSCISGRAFEDIT: TIntegerField
      FieldName = 'SCISGRAFEDIT'
      Origin = '"SPEC_COND"."SCISGRAFEDIT"'
    end
    object qSpecCondSCY: TSmallintField
      FieldName = 'SCY'
      ProviderFlags = []
    end
    object qSpecCondTIME_EDIT: TDateTimeField
      FieldName = 'TIME_EDIT'
      ProviderFlags = []
    end
    object qSpecCondSCAPPROVED1: TIntegerField
      FieldName = 'SCAPPROVED1'
      ProviderFlags = []
    end
    object qSpecCondSCAPPROVED: TIntegerField
      FieldName = 'SCAPPROVED'
      Origin = '"SPEC_COND"."SCAPPROVED"'
    end
    object qSpecCondSCUSERAPPROVED: TIBStringField
      FieldName = 'SCUSERAPPROVED'
      Origin = '"SPEC_COND"."SCUSERAPPROVED"'
      Size = 40
    end
    object qSpecCondSTSYSPODR: TIntegerField
      FieldName = 'STSYSPODR'
      Origin = '"SERVICES_TYPE"."STSYSPODR"'
    end
  end
  object quSpecCond: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  SCID,'
      '  SCNUM_N,'
      '  AGID,'
      '  SCNUMBER,'
      '  SCDATE,'
      '  SCDATEEND,'
      '  SCNOTE,'
      '  SCISDELETE,'
      '  SCISNEEDRESIGN,'
      '  SCUSERENTER,'
      '  SCTIMEENTER,'
      '  SCUSEREDIT,'
      '  SCTIMEEDIT,'
      '  SCDATEREGISTER,'
      '  SCUSERREGISTER,'
      '  SCDISCOUNT,'
      '  SCTYPEOFDISCOUNT,'
      '  SCDISCOUNTNOTE,'
      '  SCDISCOUNTAUTORISATION,'
      '  SCTYPEOFDISC,'
      '  SCDATEBEGIN,'
      '  SCMINPERIOD,'
      '  SCTARIF,'
      '  SCTARIFWITHDISCOUNT,'
      '  SCAMOUNT,'
      '  SCBALANCE,'
      '  SCDATARASCH,'
      '  SCDATERASTORJ,'
      '  POID,'
      '  SCISGRAFEDIT,'
      '  ISSCAN,'
      '  ACTUALN,'
      '  STID,'
      '  STNAME,'
      '  STTYPE,'
      '  STEDIZMER,'
      '  STDESCR,'
      '  STTARIF,'
      '  STDATEBEGIN,'
      '  STDATEEND,'
      '  STTIME,'
      '  STNOTE,'
      '  STISDELETE,'
      '  STUSERENTER,'
      '  STTIMEENTER,'
      '  STUSEREDIT,'
      '  STTIMEEDIT,'
      '  STPODRTYPE,'
      '  STISARCHIVE,'
      '  STPODR,'
      '  STPERIODOPLATY,'
      '  SDID,'
      '  SID,'
      '  SCID1,'
      '  STID1,'
      '  SCOUNT,'
      '  SNOTE,'
      '  STIMEBEGIN,'
      '  STIMEEND,'
      '  SUSERENTER,'
      '  STIMEENTER,'
      '  SUSEREDIT,'
      '  STIMEEDIT,'
      '  SISDELETE,'
      '  MINPERIOD,'
      '  EDIZME,'
      '  VOSPIT,'
      '  TIP,'
      '  PERIOD,'
      '  DOLGNY_ZAPL,'
      '  SKIDKA,'
      '  BALANCE,'
      '  AUTOR,'
      '  ZAPL_ALL,'
      '  EDIT_USER, '
      'SCAPPROVED'
      'from SPEC_COND '
      'where'
      '  SCID = :SCID')
    ModifySQL.Strings = (
      'update SPEC_COND'
      'set'
      '  AGID = :AGID,'
      '  POID = :POID,'
      '  SCAMOUNT = :SCAMOUNT,'
      '  SCBALANCE = :SCBALANCE,'
      '  SCDATARASCH = :SCDATARASCH,'
      '  SCDATE = :SCDATE,'
      '  SCDATEBEGIN = :SCDATEBEGIN,'
      '  SCDATEEND = :SCDATEEND,'
      '  SCDATERASTORJ = :SCDATERASTORJ,'
      '  SCDATEREGISTER = :SCDATEREGISTER,'
      '  SCDISCOUNT = :SCDISCOUNT,'
      '  SCDISCOUNTAUTORISATION = :SCDISCOUNTAUTORISATION,'
      '  SCDISCOUNTNOTE = :SCDISCOUNTNOTE,'
      '  SCID = :SCID,'
      '  SCISDELETE = :SCISDELETE,'
      '  SCISGRAFEDIT = :SCISGRAFEDIT,'
      '  SCISNEEDRESIGN = :SCISNEEDRESIGN,'
      '  SCMINPERIOD = :SCMINPERIOD,'
      '  SCNOTE = :SCNOTE,'
      '  SCNUM_N = :SCNUM_N,'
      '  SCNUMBER = :SCNUMBER,'
      '  SCTARIF = :SCTARIF,'
      '  SCTARIFWITHDISCOUNT = :SCTARIFWITHDISCOUNT,'
      ''
      '  SCTYPEOFDISC = :SCTYPEOFDISC,'
      '  SCTYPEOFDISCOUNT = :SCTYPEOFDISCOUNT,'
      ''
      '  SCUSERREGISTER = :SCUSERREGISTER, '
      'SCAPPROVED = :SCAPPROVED'
      'where'
      '  SCID = :OLD_SCID')
    InsertSQL.Strings = (
      'insert into SPEC_COND'
      
        '  (AGID, POID, SCAMOUNT, SCBALANCE, SCDATARASCH, SCDATE, SCDATEB' +
        'EGIN, SCDATEEND, '
      
        '   SCDATERASTORJ, SCDATEREGISTER, SCDISCOUNT, SCDISCOUNTAUTORISA' +
        'TION, SCDISCOUNTNOTE, '
      
        '   SCID, SCISDELETE, SCISGRAFEDIT, SCISNEEDRESIGN, SCMINPERIOD, ' +
        'SCNOTE, '
      '   SCNUM_N, SCNUMBER, SCTARIF, SCTARIFWITHDISCOUNT, '
      '   SCTYPEOFDISC, SCTYPEOFDISCOUNT,  SCUSERREGISTER, SCAPPROVED)'
      'values'
      
        '  (:AGID, :POID, :SCAMOUNT, :SCBALANCE, :SCDATARASCH, :SCDATE, :' +
        'SCDATEBEGIN, '
      
        '   :SCDATEEND, :SCDATERASTORJ, :SCDATEREGISTER, :SCDISCOUNT, :SC' +
        'DISCOUNTAUTORISATION, '
      
        '   :SCDISCOUNTNOTE, :SCID, :SCISDELETE, :SCISGRAFEDIT, :SCISNEED' +
        'RESIGN, '
      
        '   :SCMINPERIOD, :SCNOTE, :SCNUM_N, :SCNUMBER, :SCTARIF, :SCTARI' +
        'FWITHDISCOUNT, '
      
        '    :SCTYPEOFDISC, :SCTYPEOFDISCOUNT, :SCUSERREGISTER, :SCAPPROV' +
        'ED)')
    DeleteSQL.Strings = (
      'update SPEC_COND'
      'set'
      '  SCISDELETE = 1'
      'where'
      '  SCID = :OLD_SCID')
    Left = 339
    Top = 728
  end
  object qChekSCNum: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsAgr
    SQL.Strings = (
      'SELECT COUNT(SC.SCID) AS SCNUM_N'
      'FROM SPEC_COND SC'
      'WHERE SC.AGID = :AGID'
      '')
    Left = 371
    Top = 728
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'AGID'
        ParamType = ptUnknown
      end>
    object qChekSCNumSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      ProviderFlags = []
    end
  end
  object dsCommon: TDataSource
    DataSet = qCommon
    OnDataChange = dsCommonDataChange
    Left = 1032
    Top = 600
  end
  object qCommon: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterClose = qCommonAfterClose
    AfterInsert = qCommonAfterInsert
    AfterOpen = qCommonAfterOpen
    BeforePost = qAgrBeforePost
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT CS.* , (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,' +
        #39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS PP,'
      'p1.PLASTNAME||'#39' '#39'||SUBSTRING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS aut' +
        'or,'
      
        '(COALESCE(P_poluch.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P_poluch.PNAME,' +
        #39' '#39')||'#39' '#39'||COALESCE(P_poluch.PPATRONYMIC,'#39' '#39')) AS PP_poluch,'
      'P_poluch.PDATEBIRTH, P1.PID as pid_user,'
      
        'IIF (CS.CSUSERMONEY IS NOT NULL,(p2.PLASTNAME||'#39' '#39'||SUBSTRING(p2' +
        '.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39')),(p1.P' +
        'LASTNAME||'#39' '#39'||SUBSTRING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39'))) AS p' +
        'p_USERMONEY'
      'FROM COMMON_SERV CS'
      'LEFT OUTER JOIN PEOPLE_COMMON PC ON PC.CSID = CS.CSID'
      'LEFT OUTER JOIN PEOPLE P ON P.PID = PC.PID'
      'LEFT OUTER JOIN USERS U ON U.USNAME = CS.CSUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = CS.CSUSERMONEY'
      'LEFT OUTER JOIN PEOPLE P_poluch ON P_poluch.PID = CS.PID_POLUCH'
      'WHERE CS.CSISDELETE IS NULL AND CS.CSNOTE <> '#39#1042#1086#1079#1074#1088#1072#1090' '#1076#1077#1085#1077#1075#39
      'order by CS.CSID')
    UpdateObject = quCommon
    GeneratorField.Field = 'CSID'
    GeneratorField.Generator = 'GEN_COMMON_SERV_ID'
    Left = 1088
    Top = 640
    object qCommonCSID: TIntegerField
      FieldName = 'CSID'
      Origin = '"COMMON_SERV"."CSID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qCommonPID_POLUCH: TIntegerField
      FieldName = 'PID_POLUCH'
      Origin = '"COMMON_SERV"."PID_POLUCH"'
    end
    object qCommonCSFORM: TIntegerField
      FieldName = 'CSFORM'
      Origin = '"COMMON_SERV"."CSFORM"'
    end
    object qCommonCSAMOUNT: TIBBCDField
      FieldName = 'CSAMOUNT'
      Origin = '"COMMON_SERV"."CSAMOUNT"'
      DisplayFormat = '#,###'
      EditFormat = '0.00'
      Precision = 18
      Size = 2
    end
    object qCommonCSDATE: TDateField
      FieldName = 'CSDATE'
      Origin = '"COMMON_SERV"."CSDATE"'
    end
    object qCommonCSFORWHAT: TIBStringField
      FieldName = 'CSFORWHAT'
      Origin = '"COMMON_SERV"."CSFORWHAT"'
      Size = 255
    end
    object qCommonCSNOTE: TIBStringField
      FieldName = 'CSNOTE'
      Origin = '"COMMON_SERV"."CSNOTE"'
      Size = 255
    end
    object qCommonCSUSERENTER: TIBStringField
      FieldName = 'CSUSERENTER'
      Origin = '"COMMON_SERV"."CSUSERENTER"'
      Size = 40
    end
    object qCommonCSTIMEENTER: TDateTimeField
      FieldName = 'CSTIMEENTER'
      Origin = '"COMMON_SERV"."CSTIMEENTER"'
    end
    object qCommonCSUSEREDIT: TIBStringField
      FieldName = 'CSUSEREDIT'
      Origin = '"COMMON_SERV"."CSUSEREDIT"'
      Size = 40
    end
    object qCommonCSTIMEEDIT: TDateTimeField
      FieldName = 'CSTIMEEDIT'
      Origin = '"COMMON_SERV"."CSTIMEEDIT"'
    end
    object qCommonPID: TIntegerField
      FieldName = 'PID'
      Origin = '"COMMON_SERV"."PID"'
    end
    object qCommonAUTOR: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object qCommonPP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qCommonCSISDELETE: TIntegerField
      FieldName = 'CSISDELETE'
      Origin = '"COMMON_SERV"."CSISDELETE"'
    end
    object qCommonCSDELETENOTE: TIBStringField
      FieldName = 'CSDELETENOTE'
      Origin = '"COMMON_SERV"."CSDELETENOTE"'
      Size = 255
    end
    object qCommonCSNUMUSER: TIntegerField
      FieldName = 'CSNUMUSER'
      Origin = '"COMMON_SERV"."CSNUMUSER"'
    end
    object qCommonPP_POLUCH: TIBStringField
      FieldName = 'PP_POLUCH'
      ProviderFlags = []
      Size = 767
    end
    object qCommonPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qCommonPID_USER: TIntegerField
      FieldName = 'PID_USER'
      Origin = '"PEOPLE"."PID"'
    end
    object qCommonJLID: TIntegerField
      FieldName = 'JLID'
      Origin = '"COMMON_SERV"."JLID"'
    end
    object qCommonCSUSERMONEY: TIntegerField
      FieldName = 'CSUSERMONEY'
      Origin = '"COMMON_SERV"."CSUSERMONEY"'
    end
    object qCommonPP_USERMONEY: TIBStringField
      FieldName = 'PP_USERMONEY'
      ProviderFlags = []
      Size = 769
    end
    object qCommonRPID: TIntegerField
      FieldName = 'RPID'
      Origin = '"COMMON_SERV"."RPID"'
    end
  end
  object quCommon: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  CSID,'
      '  PID_POLUCH,'
      '  CSFORM,'
      '  CSAMOUNT,'
      '  CSDATE,'
      '  PID,'
      '  CSFORWHAT,'
      '  CSNOTE,'
      '  CSUSERENTER,'
      '  CSTIMEENTER,'
      '  CSUSEREDIT,'
      '  CSTIMEEDIT,'
      '  CSISDELETE,'
      '  CSDELETENOTE,'
      '  CSNUMUSER,'
      '  JLID,'
      '  CSUSERMONEY,'
      '  PP,'
      '  AUTOR,'
      '  PP_POLUCH,'
      '  PDATEBIRTH,'
      '  PID_USER,'
      '  PP_USERMONEY'
      'from COMMON_SERV '
      'where'
      '  CSID = :CSID')
    ModifySQL.Strings = (
      'update COMMON_SERV'
      'set'
      '  CSAMOUNT = :CSAMOUNT,'
      '  CSDATE = :CSDATE,'
      '  CSDELETENOTE = :CSDELETENOTE,'
      '  CSFORM = :CSFORM,'
      '  CSFORWHAT = :CSFORWHAT,'
      '  CSID = :CSID,'
      '  CSISDELETE = :CSISDELETE,'
      '  CSNOTE = :CSNOTE,'
      '  CSNUMUSER = :CSNUMUSER,'
      '  CSUSERMONEY = :CSUSERMONEY,'
      '  JLID = :JLID,'
      '  PID = :PID,'
      '  PID_POLUCH = :PID_POLUCH'
      'where'
      '  CSID = :OLD_CSID')
    InsertSQL.Strings = (
      'insert into COMMON_SERV'
      
        '  (CSAMOUNT, CSDATE, CSDELETENOTE, CSFORM, CSFORWHAT, CSID, CSIS' +
        'DELETE, '
      '   CSNOTE, CSNUMUSER, '
      '   CSUSERMONEY, JLID, PID, PID_POLUCH)'
      'values'
      
        '  (:CSAMOUNT, :CSDATE, :CSDELETENOTE, :CSFORM, :CSFORWHAT, :CSID' +
        ', :CSISDELETE, '
      '   :CSNOTE, :CSNUMUSER, '
      '   :CSUSERMONEY, :JLID, :PID, :PID_POLUCH)')
    DeleteSQL.Strings = (
      'null;')
    Left = 1123
    Top = 640
  end
  object qForPrintAgr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsAgr
    SQL.Strings = (
      
        'SELECT DISTINCT SD.SDNAME, PD.DSERIA, PD.DNUMBER, PD.DFROMWHO, P' +
        'D.DDATE'
      'FROM AGR_PODPISANT AP'
      'INNER JOIN P_DOCUMENTS PD ON PD.PID = AP.PID'
      'INNER JOIN SYS_DIC SD1 ON SD1.SDID = PD.DTYPE'
      'INNER JOIN SYS_DIC SD ON SD.SDID = AP.POSTATUS'
      
        'WHERE AP.AGID = :AGID AND PD.DISDELETE IS NULL AND SD1.SDPARID =' +
        ' 1463'
      'AND ap.POTYPE = 0'
      'UNION'
      
        'SELECT DISTINCT '#39'-'#39' AS SDNAME, '#39'-'#39' as DSERIA, '#39'-'#39' AS DNUMBER, '#39'-' +
        #39' AS DFROMWHO,  CURRENT_DATE AS DDATE'
      'FROM AGR_PODPISANT AP'
      'WHERE AP.AGID = :AGID'
      'AND ap.POTYPE = 1')
    Left = 427
    Top = 552
    ParamData = <
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
      end>
    object qForPrintAgrDSERIA: TIBStringField
      FieldName = 'DSERIA'
      Origin = '"P_DOCUMENTS"."DSERIA"'
      Size = 10
    end
    object qForPrintAgrDNUMBER: TIBStringField
      FieldName = 'DNUMBER'
      Origin = '"P_DOCUMENTS"."DNUMBER"'
    end
    object qForPrintAgrDFROMWHO: TIBStringField
      FieldName = 'DFROMWHO'
      Origin = '"P_DOCUMENTS"."DFROMWHO"'
      Size = 255
    end
    object qForPrintAgrDDATE: TDateField
      FieldName = 'DDATE'
      Origin = '"P_DOCUMENTS"."DDATE"'
    end
    object qForPrintAgrSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
  end
  object dsContInfo: TDataSource
    DataSet = qContInfo
    Left = 1080
    Top = 720
  end
  object qContInfo: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qContInfoAfterInsert
    BeforePost = qAgrBeforePost
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT CI.*, SD.SDNAME,'
      
        'IIF (ci.CITYPE IN (1151, 1152, 1153), COALESCE(k.NAME||'#39' , '#39'||ks' +
        '.NAME||'#39' , '#39'||ci.CIVALUE, ci.CIVALUE), ci.CIVALUE) AS CONTACT'
      'FROM CONTACTINFO CI'
      'INNER JOIN SYS_DIC SD ON SD.SDID = CI.CITYPE'
      'LEFT OUTER JOIN KLADR_STREET_MO ks ON ks.KSID = CI.KSID'
      'LEFT OUTER JOIN KLADR_MO k ON k.KID = ci.KID'
      'WHERE CI.PID = :PID')
    UpdateObject = quContInfo
    GeneratorField.Field = 'CIID'
    GeneratorField.Generator = 'GEN_CONTACTINFO'
    Left = 1104
    Top = 720
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qContInfoCIID: TIntegerField
      FieldName = 'CIID'
      Origin = '"CONTACTINFO"."CIID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qContInfoPID: TIntegerField
      FieldName = 'PID'
      Origin = '"CONTACTINFO"."PID"'
      Required = True
    end
    object qContInfoCITYPE: TIntegerField
      FieldName = 'CITYPE'
      Origin = '"CONTACTINFO"."CITYPE"'
    end
    object qContInfoCIVALUE: TIBStringField
      DisplayLabel = #1047#1085#1072#1095#1077#1085#1080#1077
      FieldName = 'CIVALUE'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qContInfoCINOTE: TIBStringField
      DisplayLabel = #1055#1088#1080#1084#1077#1095#1072#1085#1080#1077
      FieldName = 'CINOTE'
      Origin = '"CONTACTINFO"."CINOTE"'
      Size = 255
    end
    object qContInfoCIUSERENTER: TIBStringField
      DisplayLabel = #1044#1086#1073#1072#1074#1080#1083
      FieldName = 'CIUSERENTER'
      Origin = '"CONTACTINFO"."CIUSERENTER"'
      Size = 40
    end
    object qContInfoCITIMEENTER: TDateTimeField
      DisplayLabel = #1044#1086#1073#1072#1074#1083#1077#1085#1086
      FieldName = 'CITIMEENTER'
      Origin = '"CONTACTINFO"."CITIMEENTER"'
    end
    object qContInfoCIUSEREDIT: TIBStringField
      DisplayLabel = #1048#1079#1084#1077#1085#1080#1083
      FieldName = 'CIUSEREDIT'
      Origin = '"CONTACTINFO"."CIUSEREDIT"'
      Size = 40
    end
    object qContInfoCITIMEEDIT: TDateTimeField
      DisplayLabel = #1048#1079#1084#1077#1085#1077#1085#1086
      FieldName = 'CITIMEEDIT'
      Origin = '"CONTACTINFO"."CITIMEEDIT"'
    end
    object qContInfoSDNAME: TIBStringField
      DisplayLabel = #1053#1072#1079#1074#1072#1085#1080#1077
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qContInfoKSID: TIntegerField
      FieldName = 'KSID'
      Origin = '"CONTACTINFO"."KSID"'
    end
    object qContInfoKID: TIntegerField
      FieldName = 'KID'
      Origin = '"CONTACTINFO"."KID"'
    end
    object qContInfoCONTACT: TIBStringField
      FieldName = 'CONTACT'
      ProviderFlags = []
      Size = 421
    end
  end
  object quContInfo: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  CIID,'
      '  PID,'
      '  CITYPE,'
      '  CIVALUE,'
      '  CINOTE,'
      '  CIUSERENTER,'
      '  CITIMEENTER,'
      '  CIUSEREDIT,'
      '  CITIMEEDIT,'
      '  KSID,'
      '  KID,'
      '  SDNAME,'
      '  CONTACT'
      'from CONTACTINFO '
      'where'
      '  CIID = :CIID')
    ModifySQL.Strings = (
      'update CONTACTINFO'
      'set'
      '  CIID = :CIID,'
      '  CINOTE = :CINOTE,'
      '  CITYPE = :CITYPE,'
      '  CIVALUE = :CIVALUE,'
      '  KID = :KID,'
      '  KSID = :KSID,'
      '  PID = :PID'
      'where'
      '  CIID = :OLD_CIID')
    InsertSQL.Strings = (
      'insert into CONTACTINFO'
      '  (CIID, CINOTE, CITYPE, CIVALUE, KID, KSID, PID)'
      'values'
      '  (:CIID, :CINOTE, :CITYPE, :CIVALUE, :KID, :KSID, :PID)')
    DeleteSQL.Strings = (
      'delete from CONTACTINFO'
      'where'
      '  CIID = :OLD_CIID')
    Left = 1128
    Top = 720
  end
  object dsRelPeople: TDataSource
    DataSet = qRelPeople
    Left = 1056
    Top = 760
  end
  object qRelPeople: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterClose = qRelPeopleAfterClose
    AfterOpen = qRelPeopleAfterOpen
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS fio, Sd.SDNAME, P.PDATEBIRTH' +
        ', ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, PD.DSERIA' +
        ', PD.DNUMBER,'
      '       ci3.CIVALUE AS email, PD.DDATE, DL.*'
      'FROM DOV_LITSA DL'
      
        'left outer JOIN DOC_DOV_LITSA  DDL ON DL.PID_POLUCH = DDL.PID_PO' +
        'LUCH'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDELET' +
        'E IS NULL'
      'WHERE DL.PID_POLUCH = :PID'
      'AND P.PISDELETE IS NULL')
    UpdateObject = quRelPeople
    GeneratorField.Field = 'PRID'
    Left = 1088
    Top = 760
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qRelPeopleFIO: TIBStringField
      FieldName = 'FIO'
      ProviderFlags = []
      Size = 769
    end
    object qRelPeopleSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qRelPeoplePDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qRelPeoplePID: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qRelPeopleTEL_DOM: TIBStringField
      FieldName = 'TEL_DOM'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qRelPeopleTEL_MOB: TIBStringField
      FieldName = 'TEL_MOB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qRelPeopleTEL_RAB: TIBStringField
      FieldName = 'TEL_RAB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qRelPeopleDSERIA: TIBStringField
      FieldName = 'DSERIA'
      Origin = '"P_DOCUMENTS"."DSERIA"'
      Size = 10
    end
    object qRelPeopleDNUMBER: TIBStringField
      FieldName = 'DNUMBER'
      Origin = '"P_DOCUMENTS"."DNUMBER"'
    end
    object qRelPeopleEMAIL: TIBStringField
      FieldName = 'EMAIL'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qRelPeopleDDATE: TDateField
      FieldName = 'DDATE'
      Origin = '"P_DOCUMENTS"."DDATE"'
    end
    object qRelPeoplePID_POLUCH: TIntegerField
      FieldName = 'PID_POLUCH'
      Origin = '"DOV_LITSA"."PID_POLUCH"'
      Required = True
    end
    object qRelPeopleDLSTATUS: TIntegerField
      FieldName = 'DLSTATUS'
      Origin = '"DOV_LITSA"."DLSTATUS"'
    end
    object qRelPeopleDLNOTE: TIBStringField
      FieldName = 'DLNOTE'
      Origin = '"DOV_LITSA"."DLNOTE"'
      Size = 255
    end
    object qRelPeopleDLUSERENTER: TIBStringField
      FieldName = 'DLUSERENTER'
      Origin = '"DOV_LITSA"."DLUSERENTER"'
      Size = 40
    end
    object qRelPeopleDLTIMEENTER: TDateTimeField
      FieldName = 'DLTIMEENTER'
      Origin = '"DOV_LITSA"."DLTIMEENTER"'
    end
    object qRelPeopleDLUSEREDIT: TIBStringField
      FieldName = 'DLUSEREDIT'
      Origin = '"DOV_LITSA"."DLUSEREDIT"'
      Size = 40
    end
    object qRelPeopleDLTIMEEDIT: TDateTimeField
      FieldName = 'DLTIMEEDIT'
      Origin = '"DOV_LITSA"."DLTIMEEDIT"'
    end
  end
  object quRelPeople: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  PID_POLUCH,'
      '  DDLSCAN,'
      '  DDLUSERENTER,'
      '  DDLTIMEENTER,'
      '  DDLUSEREDIT,'
      '  DDLTIMEEDIT'
      'from DOC_DOV_LITSA '
      'where'
      '  PID_POLUCH = :PID_POLUCH')
    ModifySQL.Strings = (
      'update DOC_DOV_LITSA'
      'set'
      '  DDLSCAN = :DDLSCAN,'
      '  DDLTIMEEDIT = :DDLTIMEEDIT,'
      '  DDLTIMEENTER = :DDLTIMEENTER,'
      '  DDLUSEREDIT = :DDLUSEREDIT,'
      '  DDLUSERENTER = :DDLUSERENTER,'
      '  PID_POLUCH = :PID_POLUCH'
      'where'
      '  PID_POLUCH = :OLD_PID_POLUCH')
    InsertSQL.Strings = (
      'insert into DOC_DOV_LITSA'
      
        '  (DDLSCAN, DDLTIMEEDIT, DDLTIMEENTER, DDLUSEREDIT, DDLUSERENTER' +
        ', PID_POLUCH)'
      'values'
      
        '  (:DDLSCAN, :DDLTIMEEDIT, :DDLTIMEENTER, :DDLUSEREDIT, :DDLUSER' +
        'ENTER, '
      '   :PID_POLUCH)')
    DeleteSQL.Strings = (
      'delete from DOC_DOV_LITSA'
      'where'
      '  PID_POLUCH = :OLD_PID_POLUCH')
    Left = 1153
    Top = 757
  end
  object qPhotoDovLitsa: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsRelPeople
    SQL.Strings = (
      'SELECT PP.*'
      'from P_PHOTOS PP'
      'WHERE PP.PID = :pid')
    Left = 1160
    Top = 560
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object IntegerField1: TIntegerField
      FieldName = 'PID'
      Origin = '"P_PHOTOS"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object BlobField1: TBlobField
      FieldName = 'PPIMAGE'
      Origin = '"P_PHOTOS"."PPIMAGE"'
      ProviderFlags = [pfInUpdate]
      Size = 8
    end
    object IBStringField1: TIBStringField
      FieldName = 'PPNOTE'
      Origin = '"P_PHOTOS"."PPNOTE"'
      Size = 255
    end
    object IBStringField2: TIBStringField
      FieldName = 'PPUSERENTER'
      Origin = '"P_PHOTOS"."PPUSERENTER"'
      Size = 40
    end
    object DateTimeField1: TDateTimeField
      FieldName = 'PPTIMEENTER'
      Origin = '"P_PHOTOS"."PPTIMEENTER"'
    end
    object IBStringField3: TIBStringField
      FieldName = 'PPUSEREDIT'
      Origin = '"P_PHOTOS"."PPUSEREDIT"'
      Size = 40
    end
    object DateTimeField2: TDateTimeField
      FieldName = 'PPTIMEEDIT'
      Origin = '"P_PHOTOS"."PPTIMEEDIT"'
    end
  end
  object dsPhotoDovLitsa: TDataSource
    DataSet = qPhotoDovLitsa
    Left = 1208
    Top = 560
  end
  object qPayData: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction2
    DataSource = dsSpecCond
    SQL.Strings = (
      
        'SELECT GP.GPDATE, GP.GPBEGINPERIOD, GP.GPENDPERIOD, SUM(GP.GPAMO' +
        'UNT)'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.SCID = :SCID'
      '    AND GP.GPAMOUNT > 0'
      'GROUP BY 1,2,3')
    GeneratorField.Field = 'PDID'
    Left = 376
    Top = 760
    ParamData = <
      item
        DataType = ftInteger
        Name = 'SCID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qPayDataGPDATE: TDateField
      FieldName = 'GPDATE'
      Origin = '"SC_GRAFPLAT"."GPDATE"'
    end
    object qPayDataSUM: TIBBCDField
      FieldName = 'SUM'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object qPayDataGPBEGINPERIOD: TDateField
      FieldName = 'GPBEGINPERIOD'
      Origin = '"SC_GRAFPLAT"."GPBEGINPERIOD"'
    end
    object qPayDataGPENDPERIOD: TDateField
      FieldName = 'GPENDPERIOD'
      Origin = '"SC_GRAFPLAT"."GPENDPERIOD"'
    end
  end
  object qSum: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction2
    DataSource = dsSpecCond
    SQL.Strings = (
      'SELECT SUM(GP.GPAMOUNT)'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.SCID = :SCID'
      '    AND GP.GPAMOUNT > 0')
    GeneratorField.Field = 'PDID'
    Left = 568
    Top = 760
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SCID'
        ParamType = ptUnknown
      end>
    object qSumSUM: TIBBCDField
      FieldName = 'SUM'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
  end
  object qParams: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction2
    SQL.Strings = (
      'SELECT P.*'
      'FROM PARAMS P')
    GeneratorField.Field = 'PDID'
    Left = 488
    Top = 760
    object qParamsPMID: TIntegerField
      FieldName = 'PMID'
      Origin = '"PARAMS"."PMID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qParamsPMNAME: TIBStringField
      FieldName = 'PMNAME'
      Origin = '"PARAMS"."PMNAME"'
    end
    object qParamsPMVALUE: TIBStringField
      FieldName = 'PMVALUE'
      Origin = '"PARAMS"."PMVALUE"'
      Size = 255
    end
  end
  object qKolPeriod: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction2
    DataSource = dsSpecCond
    SQL.Strings = (
      'SELECT SUM(GP.GPAMOUNT/GP.GPTARIF)'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.SCID = :SCID'
      '    AND GP.GPAMOUNT > 0'
      '    AND GP.GPTARIF > 0')
    GeneratorField.Field = 'PDID'
    Left = 528
    Top = 760
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SCID'
        ParamType = ptUnknown
      end>
    object qKolPeriodSUM: TIBBCDField
      FieldName = 'SUM'
      ProviderFlags = []
      Precision = 18
      Size = 4
    end
  end
  object qCheckUsluga: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction2
    DataSource = dsSpecCond
    SQL.Strings = (
      'SELECT COALESCE(parent1.parent2, :sdid) as parent'
      'FROM'
      '('
      'SELECT MIN(t1.SDPARID) AS parent2'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, o)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, CAST('#39#39' AS VARCHAR' +
        '(2048)) AS o FROM SYS_DIC SD'
      '      WHERE sd.SDID = :sdid'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, '#39#39' || o'
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdparid = sd1.SDID)'
      ' SELECT  o || SDNAME AS SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'WHERE NOT (t1.SDPARID in (18,0))'
      ') AS parent1')
    GeneratorField.Field = 'PDID'
    Left = 440
    Top = 760
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'sdid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'sdid'
        ParamType = ptUnknown
      end>
    object qCheckUslugaPARENT: TIntegerField
      FieldName = 'PARENT'
      ProviderFlags = []
    end
  end
  object qComRaznes: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsCommon
    SQL.Strings = (
      'SELECT SC.SCNUM_N, C.CAMOUNT,  ST.STNAME'
      'FROM COMMON C'
      'INNER JOIN SERVICES S ON S.SCID = C.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SPEC_COND SC ON SC.SCID = C.SCID'
      'WHERE C.CSID = :CSID AND C.CTYPE = 1'
      'UNION all'
      
        'SELECT NULL AS SCNUM_N, C.CAMOUNT,  '#39' '#1055#1083#1072#1090#1072' '#1079#1072' '#1087#1077#1088#1077#1095#1080#1089#1083#1077#1085#1080#1077' '#1076#1077#1085#1077 +
        #1075' '#1085#1072' '#1088'/'#1089' '#1086#1073#1088#1072#1079#1086#1074#1072#1090#1077#1083#1100#1085#1086#1075#1086' '#1091#1095#1088#1077#1078#1076#1077#1085#1080#1103' '#1095#1077#1088#1077#1079' '#1073#1072#1085#1082#39' AS STNAME'
      'FROM COMMON C'
      'WHERE C.CSID = :CSID AND C.CTYPE = 2'
      'ORDER BY 2')
    Left = 1201
    Top = 637
    ParamData = <
      item
        DataType = ftInteger
        Name = 'CSID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'CSID'
        ParamType = ptUnknown
      end>
    object qComRaznesCAMOUNT: TIBBCDField
      FieldName = 'CAMOUNT'
      Origin = '"COMMON"."CAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qComRaznesSTNAME: TIBStringField
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object qComRaznesSCNUM_N: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
  end
  object dsComRaznes: TDataSource
    DataSet = qComRaznes
    Left = 1169
    Top = 637
  end
  object qBills: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT B.*,'
      'P1.PLASTNAME||'#39' '#39'||SUBSTRING(P1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        '        COALESCE(SUBSTRING(P1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39 +
        ') AS gendir,'
      'P2.PLASTNAME||'#39' '#39'||SUBSTRING(P2.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        '        COALESCE(SUBSTRING(P2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39 +
        ') AS glbuh'
      'FROM BILLS B'
      'INNER JOIN PEOPLE P1 ON P1.PID = B.BGENDIR'
      'INNER JOIN PEOPLE P2 ON P2.PID = B.BGLBUH'
      'WHERE B.BISCURRENT = 1')
    Left = 315
    Top = 515
    object qBillsBID: TIntegerField
      FieldName = 'BID'
      Origin = '"BILLS"."BID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qBillsBISCURRENT: TIntegerField
      FieldName = 'BISCURRENT'
      Origin = '"BILLS"."BISCURRENT"'
    end
    object qBillsBCOMPANYNAME: TIBStringField
      FieldName = 'BCOMPANYNAME'
      Origin = '"BILLS"."BCOMPANYNAME"'
      Size = 255
    end
    object qBillsBBANK: TIBStringField
      FieldName = 'BBANK'
      Origin = '"BILLS"."BBANK"'
      Size = 255
    end
    object qBillsBRS: TIBStringField
      FieldName = 'BRS'
      Origin = '"BILLS"."BRS"'
      Size = 40
    end
    object qBillsBKS: TIBStringField
      FieldName = 'BKS'
      Origin = '"BILLS"."BKS"'
      Size = 40
    end
    object qBillsBINN: TIBStringField
      FieldName = 'BINN'
      Origin = '"BILLS"."BINN"'
      Size = 12
    end
    object qBillsBKPP: TIBStringField
      FieldName = 'BKPP'
      Origin = '"BILLS"."BKPP"'
      Size = 12
    end
    object qBillsBBIK: TIBStringField
      FieldName = 'BBIK'
      Origin = '"BILLS"."BBIK"'
    end
    object qBillsBOGRN: TIBStringField
      FieldName = 'BOGRN'
      Origin = '"BILLS"."BOGRN"'
    end
    object qBillsBOKONH: TIBStringField
      FieldName = 'BOKONH'
      Origin = '"BILLS"."BOKONH"'
    end
    object qBillsBTEL: TIBStringField
      FieldName = 'BTEL'
      Origin = '"BILLS"."BTEL"'
    end
    object qBillsBFAX: TIBStringField
      FieldName = 'BFAX'
      Origin = '"BILLS"."BFAX"'
    end
    object qBillsBLEGALADRESS: TIBStringField
      FieldName = 'BLEGALADRESS'
      Origin = '"BILLS"."BLEGALADRESS"'
      Size = 255
    end
    object qBillsBPOSTADRESS: TIBStringField
      FieldName = 'BPOSTADRESS'
      Origin = '"BILLS"."BPOSTADRESS"'
      Size = 255
    end
    object qBillsBGENDIR: TIntegerField
      FieldName = 'BGENDIR'
      Origin = '"BILLS"."BGENDIR"'
    end
    object qBillsBGLBUH: TIntegerField
      FieldName = 'BGLBUH'
      Origin = '"BILLS"."BGLBUH"'
    end
    object qBillsBEMAIL: TIBStringField
      FieldName = 'BEMAIL'
      Origin = '"BILLS"."BEMAIL"'
      Size = 255
    end
    object qBillsBOKATO: TIBStringField
      FieldName = 'BOKATO'
      Origin = '"BILLS"."BOKATO"'
    end
    object qBillsBOKVED: TIBStringField
      FieldName = 'BOKVED'
      Origin = '"BILLS"."BOKVED"'
    end
    object qBillsGENDIR: TIBStringField
      FieldName = 'GENDIR'
      ProviderFlags = []
      Size = 769
    end
    object qBillsGLBUH: TIBStringField
      FieldName = 'GLBUH'
      ProviderFlags = []
      Size = 769
    end
    object qBillsOKPO: TIBStringField
      FieldName = 'OKPO'
      Origin = '"BILLS"."OKPO"'
    end
    object qBillsBGENDIRFIOFULL: TIBStringField
      FieldName = 'BGENDIRFIOFULL'
      Origin = '"BILLS"."BGENDIRFIOFULL"'
      Size = 255
    end
  end
  object qSCCommon: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsSpecCond
    SQL.Strings = (
      
        'SELECT CS.CSDATE, C.CAMOUNT, CS.CSFORM, p1.PLASTNAME||'#39' '#39'||SUBST' +
        'RING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS kto' +
        '_prinyal, CS.CSNOTE'
      'FROM COMMON C'
      'INNER JOIN COMMON_SERV CS ON CS.CSID = C.CSID'
      'left outer JOIN PEOPLE p1 ON p1.PID = CS.CSUSERMONEY'
      'WHERE C.SCID = :SCID AND C.CTYPE = 1'
      
        '    AND COALESCE(CS.CSNOTE,  '#39' '#39') <> '#39#1047#1072#1095#1080#1089#1083#1077#1085#1080#1077' '#1076#1077#1085#1077#1075' '#1085#1072' '#1088'/'#1089' '#1074' ' +
        #1073#1072#1085#1082#39' AND COALESCE(CS.CSNOTE,  '#39' '#39') <> '#39#1054#1078#1080#1076#1072#1077#1084#1099#1081' '#1073#1077#1079#1085#1072#1083' '#1087#1086#1089#1083#1077' '#1087 +
        #1077#1088#1077#1076#1072#1095#1080' '#1085#1072#1083#1080#1095#1085#1099#1093' '#1074' '#1073#1072#1085#1082#39
      '    AND CS.CSISDELETE IS NULL')
    Left = 963
    Top = 491
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SCID'
        ParamType = ptUnknown
      end>
    object qSCCommonCSDATE: TDateField
      FieldName = 'CSDATE'
      Origin = '"COMMON_SERV"."CSDATE"'
    end
    object qSCCommonCAMOUNT: TIBBCDField
      FieldName = 'CAMOUNT'
      Origin = '"COMMON"."CAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qSCCommonCSFORM: TIntegerField
      FieldName = 'CSFORM'
      Origin = '"COMMON_SERV"."CSFORM"'
    end
    object qSCCommonKTO_PRINYAL: TIBStringField
      FieldName = 'KTO_PRINYAL'
      ProviderFlags = []
      Size = 769
    end
    object qSCCommonCSNOTE: TIBStringField
      FieldName = 'CSNOTE'
      Origin = '"COMMON_SERV"."CSNOTE"'
      Size = 255
    end
  end
  object dsSCCommon: TDataSource
    DataSet = qSCCommon
    Left = 995
    Top = 491
  end
  object qRodstv: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT R.RID, R.PID, R.RISDELETE, (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' ' +
        #39'||COALESCE(P.PNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS P' +
        'P, P.PDATEBIRTH, podr.sdname'
      'FROM RODSTVENNIK R'
      'INNER JOIN PEOPLE P ON P.PID = R.PID'
      'INNER JOIN ('
      ' SELECT APU.PID, dp.sdid, dp.DPDATEIN, dp.DPDATEOUT, sd.SDNAME'
      'FROM DETI_PODRAZD_SC DP'
      'INNER JOIN SPEC_COND SC ON SC.SCID = DP.SCID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      ' where DP.DPTYPE = 1 AND SC.SCISDELETE IS NULL'
      ' and  CURRENT_DATE BETWEEN CAST(dp.DPDATEIN AS DATE)'
      
        ' AND COALESCE(CAST(dp.DPDATEOUT AS DATE), CURRENT_DATE)) podr ON' +
        ' podr.pid = P.PID'
      
        'WHERE R.RID = (SELECT DISTINCT R1.RID FROM RODSTVENNIK R1 WHERE ' +
        'R1.PID = :PID)'
      'AND R.PID <> :PID'
      ''
      '')
    UpdateObject = quRodstv
    Left = 786
    Top = 547
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qRodstvRID: TIntegerField
      FieldName = 'RID'
      Origin = '"RODSTVENNIK"."RID"'
      Required = True
    end
    object qRodstvPID: TIntegerField
      FieldName = 'PID'
      Origin = '"RODSTVENNIK"."PID"'
      Required = True
    end
    object qRodstvPP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object qRodstvRISDELETE: TIntegerField
      FieldName = 'RISDELETE'
      Origin = '"RODSTVENNIK"."RISDELETE"'
    end
    object qRodstvPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qRodstvSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
  end
  object quRodstv: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  RID,'
      '  PID,'
      '  RISDELETE,'
      '  PP'
      'from RODSTVENNIK '
      'where'
      '  PID = :PID')
    ModifySQL.Strings = (
      'update RODSTVENNIK'
      'set'
      '  PID = :PID,'
      '  RID = :RID,'
      '  RISDELETE = :RISDELETE'
      'where'
      '  PID = :OLD_PID')
    InsertSQL.Strings = (
      'insert into RODSTVENNIK'
      '  (PID, RID, RISDELETE)'
      'values'
      '  (:PID, :RID, :RISDELETE)')
    DeleteSQL.Strings = (
      'delete from RODSTVENNIK'
      'where'
      '  PID = :OLD_PID')
    Left = 818
    Top = 547
  end
  object dsRodstv: TDataSource
    DataSet = qRodstv
    Left = 754
    Top = 547
  end
  object qGenRodstv: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT GEN_ID(GEN_RODSTVENNIK_ID,1) FROM rdb$database')
    Left = 832
    Top = 528
    object qGenRodstvGEN_ID: TLargeintField
      FieldName = 'GEN_ID'
      ProviderFlags = []
    end
  end
  object qCheckCommon: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsSpecCond
    SQL.Strings = (
      'SELECT SC.SCID'
      'FROM SPEC_COND SC'
      'INNER JOIN COMMON C ON C.SCID = SC.SCID'
      'INNER JOIN COMMON_SERV CS ON CS.CSID = C.CSID'
      
        'WHERE SC.SCISDELETE IS NULL AND SC.SCID = :SCID AND CS.CSISDELET' +
        'E IS NULL')
    Left = 154
    Top = 627
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SCID'
        ParamType = ptUnknown
      end>
    object qCheckCommonSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
  end
  object qPrintDovLitsa: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, Sd.SDNAME, P.PDATEBI' +
        'RTH, ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, (PD.DSERI' +
        'A||'#39'   '#39'||PD.DNUMBER) AS passport,'
      
        '       ci3.CIVALUE AS email, COALESCE( CAST (PD.DDATE as VARCHAR' +
        '(10)), '#39' '#39') AS passp_date'
      'FROM DOV_LITSA DL'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDELET' +
        'E IS NULL'
      'WHERE DL.PID_POLUCH = :pid'
      'UNION ALL'
      
        'SELECT FIRST 5 NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRON' +
        'YMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE'
      'FROM DOV_LITSA'
      'order by 1 desc')
    Left = 106
    Top = 491
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qPrintDovLitsaPLASTNAME: TIBStringField
      FieldName = 'PLASTNAME'
      Origin = '"PEOPLE"."PLASTNAME"'
      Size = 255
    end
    object qPrintDovLitsaPNAME: TIBStringField
      FieldName = 'PNAME'
      Origin = '"PEOPLE"."PNAME"'
      Size = 255
    end
    object qPrintDovLitsaPPATRONYMIC: TIBStringField
      FieldName = 'PPATRONYMIC'
      Origin = '"PEOPLE"."PPATRONYMIC"'
      Size = 255
    end
    object qPrintDovLitsaSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPrintDovLitsaPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qPrintDovLitsaTEL_DOM: TIBStringField
      FieldName = 'TEL_DOM'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsaTEL_MOB: TIBStringField
      FieldName = 'TEL_MOB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsaTEL_RAB: TIBStringField
      FieldName = 'TEL_RAB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsaPASSPORT: TIBStringField
      FieldName = 'PASSPORT'
      ProviderFlags = []
      Size = 33
    end
    object qPrintDovLitsaEMAIL: TIBStringField
      FieldName = 'EMAIL'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsaPASSP_DATE: TIBStringField
      FieldName = 'PASSP_DATE'
      ProviderFlags = []
      Size = 10
    end
  end
  object qPrintDovLitsa_empty: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, Sd.SDNAME, P.PDATEBI' +
        'RTH, ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, (PD.DSERI' +
        'A||'#39' '#39'||PD.DNUMBER) AS passport,'
      '       ci3.CIVALUE AS email, PD.DDATE'
      'FROM DOC_DOV_LITSA  DDL'
      'left outer JOIN DOV_LITSA DL ON DL.PID_POLUCH = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL'
      'WHERE DDL.PID_POLUCH = -10'
      'UNION all'
      
        'SELECT FIRST 13 NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRO' +
        'NYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE'
      'FROM DOC_DOV_LITSA')
    Left = 106
    Top = 547
    object IBStringField4: TIBStringField
      FieldName = 'PLASTNAME'
      Origin = '"PEOPLE"."PLASTNAME"'
      Size = 255
    end
    object IBStringField5: TIBStringField
      FieldName = 'PNAME'
      Origin = '"PEOPLE"."PNAME"'
      Size = 255
    end
    object IBStringField6: TIBStringField
      FieldName = 'PPATRONYMIC'
      Origin = '"PEOPLE"."PPATRONYMIC"'
      Size = 255
    end
    object IBStringField7: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object DateField1: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qPrintDovLitsa_emptyTEL_DOM: TIBStringField
      FieldName = 'TEL_DOM'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsa_emptyTEL_MOB: TIBStringField
      FieldName = 'TEL_MOB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsa_emptyTEL_RAB: TIBStringField
      FieldName = 'TEL_RAB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsa_emptyPASSPORT: TIBStringField
      FieldName = 'PASSPORT'
      ProviderFlags = []
      Size = 42
    end
    object qPrintDovLitsa_emptyEMAIL: TIBStringField
      FieldName = 'EMAIL'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object qPrintDovLitsa_emptyDDATE: TDateField
      FieldName = 'DDATE'
      Origin = '"P_DOCUMENTS"."DDATE"'
    end
  end
  object rvdsPeople: TRvDataSetConnection
    LocalFilter = False
    RuntimeVisibility = rtEndUser
    DataSet = qPeople
    Left = 456
    Top = 208
  end
  object qUserFilter: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT LIST(t1.sdid, '#39', '#39') AS list_sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, o)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, CAST('#39#39' AS VARCHAR' +
        '(2048)) AS o FROM SYS_DIC SD'
      '      WHERE sd.SDPARID in (1412, 1413)'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, '#39#39' || o'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t'
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  o || SDNAME AS SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'INNER JOIN SYS_DIC sd1 ON sd1.SDID = t1.sdid'
      'WHERE NOT EXISTS'
      '('
      'SELECT t2.sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, o)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, CAST('#39#39' AS VARCHAR' +
        '(2048)) AS o FROM SYS_DIC SD'
      '      WHERE sd.SDPARID in (1412, 1413)'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, '#39#39' || o'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t'
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  o || SDNAME AS SDNAME, SDID, SDPARID FROM tree t'
      ') AS t2'
      'INNER JOIN SYS_DIC sd1 ON sd1.SDID = t1.sdid'
      'WHERE t2.sdparid = t1.sdid'
      ')')
    Left = 136
    Top = 32
    object qUserFilterLIST_SDID: TMemoField
      FieldName = 'LIST_SDID'
      ProviderFlags = []
      BlobType = ftMemo
      Size = 8
    end
  end
  object qBNInfo: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsPaymants_Agr
    SQL.Strings = (
      'SELECT BP.*'
      'FROM BANK_PORUCH BP'
      'INNER JOIN PAYMANTS_AGR pa ON pa.BPID = bp.BPID'
      'WHERE pa.PAID = :paid')
    Left = 113
    Top = 446
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'paid'
        ParamType = ptUnknown
      end>
    object qBNInfoBPPLAT1: TIBStringField
      FieldName = 'BPPLAT1'
      Origin = '"BANK_PORUCH"."BPPLAT1"'
      Size = 2048
    end
    object qBNInfoBPNAZNACHPLAT: TIBStringField
      FieldName = 'BPNAZNACHPLAT'
      Origin = '"BANK_PORUCH"."BPNAZNACHPLAT"'
      Size = 2048
    end
    object qBNInfoBPDATAPOSTUPILO: TDateField
      FieldName = 'BPDATAPOSTUPILO'
      Origin = '"BANK_PORUCH"."BPDATAPOSTUPILO"'
    end
    object qBNInfoBPSUMMA: TIBBCDField
      FieldName = 'BPSUMMA'
      Origin = '"BANK_PORUCH"."BPSUMMA"'
      Precision = 18
      Size = 2
    end
    object qBNInfoBPID: TIntegerField
      FieldName = 'BPID'
      Origin = '"BANK_PORUCH"."BPID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qBNInfoBPNAME: TIBStringField
      FieldName = 'BPNAME'
      Origin = '"BANK_PORUCH"."BPNAME"'
      Size = 255
    end
    object qBNInfoBPNUM: TIntegerField
      FieldName = 'BPNUM'
      Origin = '"BANK_PORUCH"."BPNUM"'
    end
    object qBNInfoBPDATE: TDateField
      FieldName = 'BPDATE'
      Origin = '"BANK_PORUCH"."BPDATE"'
    end
    object qBNInfoBPPLATSCHET: TIBStringField
      FieldName = 'BPPLATSCHET'
      Origin = '"BANK_PORUCH"."BPPLATSCHET"'
      Size = 255
    end
    object qBNInfoBPPOLUCHSCHET: TIBStringField
      FieldName = 'BPPOLUCHSCHET'
      Origin = '"BANK_PORUCH"."BPPOLUCHSCHET"'
      Size = 255
    end
    object qBNInfoBPPLATINN: TIBStringField
      FieldName = 'BPPLATINN'
      Origin = '"BANK_PORUCH"."BPPLATINN"'
      Size = 12
    end
    object qBNInfoBPPLATBIK: TIBStringField
      FieldName = 'BPPLATBIK'
      Origin = '"BANK_PORUCH"."BPPLATBIK"'
      Size = 255
    end
    object qBNInfoBPPLATBANK1: TIBStringField
      FieldName = 'BPPLATBANK1'
      Origin = '"BANK_PORUCH"."BPPLATBANK1"'
      Size = 2048
    end
    object qBNInfoBPPOLUCHINN: TIBStringField
      FieldName = 'BPPOLUCHINN'
      Origin = '"BANK_PORUCH"."BPPOLUCHINN"'
      Size = 12
    end
    object qBNInfoBPPOLUCH1: TIBStringField
      FieldName = 'BPPOLUCH1'
      Origin = '"BANK_PORUCH"."BPPOLUCH1"'
      Size = 2048
    end
    object qBNInfoBPPOLUCHBIK: TIBStringField
      FieldName = 'BPPOLUCHBIK'
      Origin = '"BANK_PORUCH"."BPPOLUCHBIK"'
      Size = 255
    end
    object qBNInfoBPPOLUCHBANK1: TIBStringField
      FieldName = 'BPPOLUCHBANK1'
      Origin = '"BANK_PORUCH"."BPPOLUCHBANK1"'
      Size = 2048
    end
    object qBNInfoBPSTATUSSOST: TIBStringField
      FieldName = 'BPSTATUSSOST'
      Origin = '"BANK_PORUCH"."BPSTATUSSOST"'
      Size = 255
    end
    object qBNInfoBPPLATKPP: TIBStringField
      FieldName = 'BPPLATKPP'
      Origin = '"BANK_PORUCH"."BPPLATKPP"'
      Size = 12
    end
    object qBNInfoBPPOLUCHKPP: TIBStringField
      FieldName = 'BPPOLUCHKPP'
      Origin = '"BANK_PORUCH"."BPPOLUCHKPP"'
      Size = 12
    end
    object qBNInfoBPPOKAZKBK: TIBStringField
      FieldName = 'BPPOKAZKBK'
      Origin = '"BANK_PORUCH"."BPPOKAZKBK"'
      Size = 255
    end
    object qBNInfoBPOKATO: TIBStringField
      FieldName = 'BPOKATO'
      Origin = '"BANK_PORUCH"."BPOKATO"'
      Size = 255
    end
    object qBNInfoBPPOKAZOSNOV: TIBStringField
      FieldName = 'BPPOKAZOSNOV'
      Origin = '"BANK_PORUCH"."BPPOKAZOSNOV"'
      Size = 255
    end
    object qBNInfoBPPOKAZPERIODA: TIBStringField
      FieldName = 'BPPOKAZPERIODA'
      Origin = '"BANK_PORUCH"."BPPOKAZPERIODA"'
      Size = 255
    end
    object qBNInfoBPPOKAZNOMERA: TIBStringField
      FieldName = 'BPPOKAZNOMERA'
      Origin = '"BANK_PORUCH"."BPPOKAZNOMERA"'
      Size = 255
    end
    object qBNInfoBPPOKAZDATY: TIBStringField
      FieldName = 'BPPOKAZDATY'
      Origin = '"BANK_PORUCH"."BPPOKAZDATY"'
      Size = 255
    end
    object qBNInfoBPPOKAZTIPA: TIBStringField
      FieldName = 'BPPOKAZTIPA'
      Origin = '"BANK_PORUCH"."BPPOKAZTIPA"'
      Size = 255
    end
    object qBNInfoBPVIDOPLATY: TIBStringField
      FieldName = 'BPVIDOPLATY'
      Origin = '"BANK_PORUCH"."BPVIDOPLATY"'
      Size = 255
    end
    object qBNInfoBPPRIHOD: TIntegerField
      FieldName = 'BPPRIHOD'
      Origin = '"BANK_PORUCH"."BPPRIHOD"'
    end
    object qBNInfoBPTYPE: TIntegerField
      FieldName = 'BPTYPE'
      Origin = '"BANK_PORUCH"."BPTYPE"'
    end
    object qBNInfoBPDATASPISANO: TDateField
      FieldName = 'BPDATASPISANO'
      Origin = '"BANK_PORUCH"."BPDATASPISANO"'
    end
    object qBNInfoBPUSERENTER: TIBStringField
      FieldName = 'BPUSERENTER'
      Origin = '"BANK_PORUCH"."BPUSERENTER"'
      Size = 40
    end
    object qBNInfoBPTIMEENTER: TDateTimeField
      FieldName = 'BPTIMEENTER'
      Origin = '"BANK_PORUCH"."BPTIMEENTER"'
    end
    object qBNInfoBPUSEREDIT: TIBStringField
      FieldName = 'BPUSEREDIT'
      Origin = '"BANK_PORUCH"."BPUSEREDIT"'
      Size = 40
    end
    object qBNInfoBPTIMEEDIT: TDateTimeField
      FieldName = 'BPTIMEEDIT'
      Origin = '"BANK_PORUCH"."BPTIMEEDIT"'
    end
  end
  object sqlSCUndelete: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      
        'UPDATE COMMON_SERV CS SET CS.CSISDELETE = NULL, CS.CSDELETENOTE ' +
        '= NULL'
      'WHERE CS.CSID = :CSID')
    Transaction = DMInv.IBTransaction1
    Left = 227
    Top = 500
  end
  object qPeople_temp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterClose = qPeopleAfterClose
    AfterOpen = qPeopleAfterOpen
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, P.PLASTNAME_ENGLISH,' +
        ' P.PNAME_ENGLISH, p.PDATEBIRTH, P.PID, (COALESCE(P.PLASTNAME,'#39' '#39 +
        ')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39'))' +
        ' AS PP,'
      'IIF((DATEDIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)) < 0, D' +
        'ATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE)-1, '
      'DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE)) as let, '
      'IIF( (DATEDIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)) < 0, 1' +
        '2 + (DATEDIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)), (DATE' +
        'DIFF( MONTH FROM P.PDATEBIRTH to CURRENT_DATE) - '
      
        '(DATEDIFF( YEAR FROM P.PDATEBIRTH to CURRENT_DATE) * 12)) ) as m' +
        'es, '
      'SD.SDNAME, IIF (PF.PID IS NULL, 0, 1) AS is_image, '
      'IIF(:param_distinct  = 1, NULL, SD2.SDNAME) AS OSN_PODR, '
      ' CAST(max_in.max_day as DATE) AS last_in, '
      '  IIF(is_agrscan.AGID IS NULL, 0, 1) AS agr_scan, '
      ' mp.plat_date AS max_date_pay, '
      'PMP.PMPISDOLG, '
      'IIF(DDL.PID_POLUCH IS NULL,0,1) AS dovlitsa, '
      
        '(COALESCE(DZ.dolgny_zapl,0) - COALESCE(Zall.zapl_all,0)) AS bala' +
        'nce_all, '
      
        '(COALESCE(ZvB.zaplvb,0) - COALESCE(ZBB.zaplbb/100,0)) AS bal_ban' +
        'k_perc, PMP.PMPCONTRNOTE,'
      'pmp.PMPDIRNOTE, PMP.PMPMANAGERNOTE,'
      
        'IIF(KM1.pid IS NULL, 0, 1) AS ohr_mes, IIF(KM2.pid IS NULL, 0, 1' +
        ') AS ohr_mes_zapr_vhod, AD.abs_dolg, COALESCE(izmgr.scisgrafedit' +
        ', 0) AS scisgrafedit '
      
        ' , CAST(NULL AS INTEGER) AS  PID1, CAST(NULL AS INTEGER) AS SCID' +
        ', CAST(NULL AS INTEGER) AS SCNUM_N, CAST(NULL AS DATE) AS SCDATE' +
        'BEGIN, CAST(NULL AS DATE) AS SCDATEEND, '
      
        'CAST(NULL AS DATE) AS SCDATERASTORJ, cast(NULL as varchar(255)) ' +
        'AS STNAME, CAST(NULL AS NUMERIC(18,2)) AS STTARIF, CAST(NULL AS ' +
        'NUMERIC(18,2)) AS SCTARIFWITHDISCOUNT, '
      
        'CAST(NULL AS INTEGER) AS SCOUNT, CAST(NULL AS NUMERIC(18,2)) AS ' +
        'dolgny_zapl, CAST(NULL AS NUMERIC(18,2)) AS skidka, CAST(NULL AS' +
        ' NUMERIC(18,2)) AS balance, CAST(NULL AS NUMERIC(18,2)) AS zapl_' +
        'all, CAST(NULL AS INTEGER) AS SC_copy, '
      
        ' CAST(NULL AS DATE) AS SCTIMEENTER, CAST(NULL AS DATE) AS SCDATE' +
        ', CAST(NULL AS INTEGER) AS select_people'
      'FROM PEOPLE P '
      'LEFT OUTER JOIN '
      '( '
      'SELECT DISTINCT KM.PID '
      'FROM KPP_MESSAGES KM '
      
        'WHERE (CURRENT_TIMESTAMP BETWEEN COALESCE(KM.KMDATEBEGIN, CURREN' +
        'T_TIMESTAMP) '
      '    AND  COALESCE(KM.KMDATEEND, CURRENT_TIMESTAMP)) '
      ') AS km1 on km1.pid = p.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT DISTINCT KM.PID '
      'FROM KPP_MESSAGES KM '
      
        'WHERE (CURRENT_TIMESTAMP BETWEEN COALESCE(KM.KMDATEBEGIN, CURREN' +
        'T_TIMESTAMP) '
      '    AND  COALESCE(KM.KMDATEEND, CURRENT_TIMESTAMP)) '
      '    and km.KMDEJSTVIE = 1 '
      ') AS km2 on km2.pid = p.PID '
      'LEFT OUTER JOIN P_MISC_PROP PMP on PMP.PID = P.PID '
      'LEFT OUTER JOIN P_STATUS PS on PS.PID = P.PID '
      'LEFT OUTER JOIN SYS_DIC SD on SD.SDID = PS.SDID '
      'LEFT OUTER JOIN P_PHOTOS PF ON PF.PID = P.PID '
      '--'#1085#1072#1083#1080#1095#1080#1077' '#1080#1079#1084#1077#1085#1077#1085#1085#1086#1075#1086' '#1075#1088#1072#1092#1080#1082#1072' '#1087#1086' '#1086#1089#1085#1086#1074#1085#1086#1081' '#1091#1089#1083#1091#1075#1077' '
      'LEFT OUTER JOIN(SELECT apu1.pid, sc.scisgrafedit '
      '                      FROM spec_cond sc '
      
        '                      INNER JOIN agr_poluch_uslug apu1 ON apu1.a' +
        'gid = sc.agid '
      '                      INNER JOIN services s ON s.scid = sc.scid '
      'INNER JOIN services_type st ON st.stid = s.stid '
      'INNER JOIN(SELECT t1.sdid '
      
        'FROM (WITH RECURSIVE tree (sdname, sdid, sdparid, o) AS (SELECT ' +
        'sd.sdname, sd.sdid, '
      'sd.sdparid, '
      'CAST('#39#39' AS VARCHAR(2048)) AS o '
      'FROM sys_dic sd '
      'WHERE sd.sdparid = 1880 '
      'UNION ALL '
      'SELECT sd1.sdname, sd1.sdid, '
      'sd1.sdparid, '#39#39' || o '
      'FROM sys_dic sd1 '
      
        'INNER JOIN tree t ON t.sdid = sd1.sdparid) SELECT o || sdname AS' +
        ' sdname, '
      'sdid, sdparid '
      'FROM tree t) AS t1) AS sd_osn ON sd_osn.sdid = st.sdid '
      
        'WHERE CURRENT_DATE BETWEEN sc.scdatebegin AND COALESCE(sc.scdate' +
        'rastorj, sc.scdateend) AND '
      
        'sc.scisgrafedit = 1 AND sc.SCISDELETE IS NULL) AS izmgr ON izmgr' +
        '.pid = p.pid '
      '--'#1082#1088#1072#1081#1085#1080#1081' '#1074#1093#1086#1076' '
      
        'LEFT OUTER JOIN ( SELECT PVV.PID, MAX(PVV.PVTIME_IN) AS max_day ' +
        'FROM P_VIZIT PVV GROUP BY 1) AS max_in ON max_in.PID = P.PID '
      '--'#1087#1086#1089#1083#1077#1076#1085#1080#1081' '#1087#1083#1072#1090#1077#1078' '
      
        'LEFT OUTER JOIN (SELECT CS.PID_POLUCH, MAX(CS.CSDATE) AS plat_da' +
        'te '
      'FROM COMMON_SERV CS '
      'WHERE  CS.CSISDELETE IS NULL '
      'GROUP BY 1 '
      ') AS mp ON mp.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN  '
      '(SELECT APU.PID, A1.AGID  '
      'FROM AGREEMENTS A  '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID  '
      'INNER JOIN A_SCAN A1 ON A1.AGID = A.AGID  '
      
        'WHERE A.AGID = APU.AGID AND CURRENT_DATE <= coalesce(A.AGDATECLO' +
        'SE, A.AGDATEEND) AND A.AGISDELETE IS NULL  '
      ') AS is_agrscan ON is_agrscan.PID = P.PID  '
      'LEFT OUTER JOIN DOC_DOV_LITSA DDL ON DDL.PID_POLUCH = P.PID  '
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DA' +
        'TE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATE' +
        'OUT AS DATE), CURRENT_DATE+3650) '
      
        'LEFT OUTER JOIN DETI_PODRAZD_MISC DPM ON DPM.PID = P.PID AND CUR' +
        'RENT_DATE BETWEEN CAST(dpm.DPDATEIN AS DATE) AND COALESCE(CAST(d' +
        'pm.DPDATEOUT AS DATE), CURRENT_DATE+3650) '
      'LEFT OUTER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT APU.PID, SUM(GP.GPAMOUNT) AS dolgny_zapl '
      'FROM SC_GRAFPLAT GP '
      'INNER JOIN SPEC_COND SC ON SC.SCID = GP.SCID '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE (GP.GPDATE <= CURRENT_DATE) AND SC.SCISDELETE IS NULL AND ' +
        'A.AGISDELETE IS NULL '
      'GROUP BY 1) AS DZ ON DZ.PID = P.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zaplbb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      '      AND CS.CSFORM = 0 '
      'AND CS.CSDATE >= :first_dec40513 '
      'GROUP BY 1 '
      ') AS ZBB ON ZBB.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zaplvb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE = 2 '
      '      AND CS.CSFORM = 0 '
      '      AND CS.CSDATE >= :first_dec40513 '
      'GROUP BY 1 '
      ') AS ZvB ON ZvB.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zapl_all '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      'GROUP BY 1 '
      ') AS Zall ON Zall.PID_POLUCH = P.PID '
      'LEFT OUTER JOIN '
      '( '
      
        'SELECT P5.PID, (COALESCE(DZ1.dolgny_zapl,0) - COALESCE(ZBB1.zapl' +
        'bb,0)) AS abs_dolg '
      'FROM PEOPLE P5 '
      'LEFT OUTER JOIN '
      '( '
      'SELECT APU.PID, SUM(GP.GPAMOUNT) AS dolgny_zapl '
      'FROM SC_GRAFPLAT GP '
      'INNER JOIN SPEC_COND SC ON SC.SCID = GP.SCID '
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE (GP.GPDATE <= CURRENT_DATE) AND SC.SCISDELETE IS NULL AND ' +
        'A.AGISDELETE IS NULL '
      'GROUP BY 1) AS DZ1 ON DZ1.PID = P5.PID '
      'LEFT OUTER JOIN '
      '( '
      'SELECT CS.PID_POLUCH, SUM(COM.CAMOUNT) AS zaplbb '
      'FROM COMMON_SERV CS '
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID '
      'INNER JOIN SPEC_COND SC ON SC.SCID = COM.SCID '
      'INNER JOIN AGREEMENTS A ON A.AGID = SC.AGID '
      
        'WHERE CS.CSISDELETE IS NULL AND SC.SCISDELETE IS NULL AND A.AGIS' +
        'DELETE IS NULL '
      '     AND COM.CTYPE < 2 '
      'GROUP BY 1 '
      ') AS ZBB1 ON ZBB1.PID_POLUCH = P5.PID '
      
        'WHERE (COALESCE(DZ1.dolgny_zapl,0) - COALESCE(ZBB1.zaplbb,0)) > ' +
        '0 '
      ') AS AD ON AD.PID = P.PID '
      'WHERE P.PISDELETE IS NULL'
      ' ORDER BY 2,1,3')
    GeneratorField.Field = 'TFID'
    Left = 424
    Top = 248
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'param_distinct'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'first_dec40513'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'first_dec40513'
        ParamType = ptUnknown
      end>
  end
  object qPodotch: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsCommon
    SQL.Strings = (
      'SELECT RP.*'
      'FROM RASPRED_PODOTCH RP'
      'WHERE RP.RPID = :RPID')
    Left = 1019
    Top = 668
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'RPID'
        ParamType = ptUnknown
      end>
    object qPodotchRPID: TIntegerField
      FieldName = 'RPID'
      Origin = '"RASPRED_PODOTCH"."RPID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qPodotchRPDATE: TDateField
      FieldName = 'RPDATE'
      Origin = '"RASPRED_PODOTCH"."RPDATE"'
    end
    object qPodotchPPID: TIntegerField
      FieldName = 'PPID'
      Origin = '"RASPRED_PODOTCH"."PPID"'
    end
    object qPodotchRPSUMMA: TIBBCDField
      FieldName = 'RPSUMMA'
      Origin = '"RASPRED_PODOTCH"."RPSUMMA"'
      Precision = 18
      Size = 2
    end
    object qPodotchRPUSERENTER: TIBStringField
      FieldName = 'RPUSERENTER'
      Origin = '"RASPRED_PODOTCH"."RPUSERENTER"'
      Size = 40
    end
    object qPodotchRPTIMEENTER: TDateTimeField
      FieldName = 'RPTIMEENTER'
      Origin = '"RASPRED_PODOTCH"."RPTIMEENTER"'
    end
    object qPodotchRPUSEREDIT: TIBStringField
      FieldName = 'RPUSEREDIT'
      Origin = '"RASPRED_PODOTCH"."RPUSEREDIT"'
      Size = 40
    end
    object qPodotchRPTIMEEDIT: TDateTimeField
      FieldName = 'RPTIMEEDIT'
      Origin = '"RASPRED_PODOTCH"."RPTIMEEDIT"'
    end
    object qPodotchPPID_TO: TIntegerField
      FieldName = 'PPID_TO'
      Origin = '"RASPRED_PODOTCH"."PPID_TO"'
    end
    object qPodotchRPTYPE: TIntegerField
      FieldName = 'RPTYPE'
      Origin = '"RASPRED_PODOTCH"."RPTYPE"'
    end
    object qPodotchRPISDELETE: TIntegerField
      FieldName = 'RPISDELETE'
      Origin = '"RASPRED_PODOTCH"."RPISDELETE"'
    end
    object qPodotchCSID: TSmallintField
      FieldName = 'CSID'
      Origin = '"RASPRED_PODOTCH"."CSID"'
    end
    object qPodotchRPNOTE: TIBStringField
      FieldName = 'RPNOTE'
      Origin = '"RASPRED_PODOTCH"."RPNOTE"'
      Size = 255
    end
    object qPodotchRPFORM: TIntegerField
      FieldName = 'RPFORM'
      Origin = '"RASPRED_PODOTCH"."RPFORM"'
    end
    object qPodotchBPID: TIntegerField
      FieldName = 'BPID'
      Origin = '"RASPRED_PODOTCH"."BPID"'
    end
  end
  object qPrintAllDovLitsa: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT DDL.PID_POLUCH, P.PLASTNAME, P.PNAME, P.PPATRONYMIC, Sd.S' +
        'DNAME, P.PDATEBIRTH, ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, (PD.DSERI' +
        'A||'#39'   '#39'||PD.DNUMBER) AS passport,'
      
        '       ci3.CIVALUE AS email, PD.DDATE, A.AGNUM_N, A.AGNUM, SD2.S' +
        'DNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA  DDL'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = DDL.PID_POLUCH AND C' +
        'URRENT_DATE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(' +
        'dp.DPDATEOUT AS DATE), CURRENT_DATE+3650)'
      'LEFT OUTER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID '
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'left outer JOIN DOV_LITSA DL ON DL.PID_POLUCH = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'ORDER BY 1 ASC, 2 DESC'
      '')
    Left = 67
    Top = 500
  end
  object qTMPPrintAllDovLitsa: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT main.*'
      'FROM'
      '('
      
        'SELECT DDL.PID_POLUCH, P.PLASTNAME, P.PNAME, P.PPATRONYMIC, Sd.S' +
        'DNAME AS status, P.PDATEBIRTH, ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, (PD.DSERI' +
        'A||'#39'   '#39'||PD.DNUMBER) AS passport,'
      
        '       ci3.CIVALUE AS email, PD.DDATE, A.AGNUM_N, A.AGNUM, SD2.S' +
        'DNAME AS osn_podr,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA  DDL'
      
        'LEFT OUTER JOIN DETI_PODRAZD DP ON DP.PID = DDL.PID_POLUCH AND C' +
        'URRENT_DATE BETWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(' +
        'dp.DPDATEOUT AS DATE), CURRENT_DATE+3650)'
      'LEFT OUTER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID '
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'left outer JOIN DOV_LITSA DL ON DL.PID_POLUCH = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDELET' +
        'E IS NULL'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS osn_podr,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS SDNAME,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS osn_podr,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS osn_podr,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS osn_podr,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      '    UNION all'
      
        'SELECT DDL.PID_POLUCH,  NULL AS PLASTNAME, NULL AS PNAME, NULL A' +
        'S PPATRONYMIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_d' +
        'om,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      '       NULL AS AGNUM_N, NULL AS AGNUM, NULL AS osn_podr,'
      
        '       (COALESCE(P1.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P1.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P1.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM DOC_DOV_LITSA DDL'
      'LEFT OUTER JOIN AGR_POLUCH_USLUG APU ON APU.PID = DDL.PID_POLUCH'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'LEFT OUTER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'left outer JOIN PEOPLE P1 ON P1.PID = DDL.PID_POLUCH'
      'left outer JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      ''
      ''
      ''
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      'UNION ALL'
      
        'SELECT P.PID, NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRONY' +
        'MIC, NULL AS status, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE,'
      'A.AGNUM_N, A.AGNUM, SD2.SDNAME AS osn_podr,'
      
        '       (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS poluch_fio,'
      
        '       (COALESCE(P2.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P2.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P2.PPATRONYMIC,'#39' '#39')) AS podp_fio'
      'FROM PEOPLE P'
      
        'INNER JOIN DETI_PODRAZD DP ON DP.PID = P.PID AND CURRENT_DATE BE' +
        'TWEEN CAST(dp.DPDATEIN AS DATE) AND COALESCE(CAST(dp.DPDATEOUT A' +
        'S DATE), CURRENT_DATE+3650)'
      'INNER JOIN SYS_DIC SD2 ON SD2.SDID = DP.SDID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.PID = P.PID'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = A.AGID'
      'INNER JOIN PEOPLE P2 ON P2.PID = AP.PID'
      'WHERE NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = P.PID'
      ')'
      'AND A.AGISDELETE IS NULL'
      '    AND COALESCE(A.AGDATECLOSE, A.AGDATEEND) >= CURRENT_DATE'
      ') AS main')
    Left = 35
    Top = 500
  end
  object quContrComment: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  PLASTNAME,'
      '  PNAME,'
      '  PPATRONYMIC,'
      '  PDATEBIRTH,'
      '  PID,'
      '  PP,'
      '  LET,'
      '  MES,'
      '  SDNAME,'
      '  IS_IMAGE,'
      '  OSN_PODR,'
      '  LAST_IN,'
      '  AGR_SCAN,'
      '  MAX_DATE_PAY,'
      '  PMPISDOLG,'
      '  DOVLITSA,'
      '  BALANCE_ALL,'
      '  BAL_BANK_PERC,'
      '  PMPCONTRNOTE,'
      '  PMPDIRNOTE,'
      '  PMPMANAGERNOTE,'
      '  OHR_MES,'
      '  OHR_MES_ZAPR_VHOD,'
      '  ABS_DOLG,'
      '  SCISGRAFEDIT,'
      '  PID1,'
      '  SCID,'
      '  SCNUM_N,'
      '  SCDATEBEGIN,'
      '  SCDATEEND,'
      '  SCDATERASTORJ,'
      '  STNAME,'
      '  STTARIF,'
      '  SCTARIFWITHDISCOUNT,'
      '  SCOUNT,'
      '  DOLGNY_ZAPL,'
      '  SKIDKA,'
      '  BALANCE,'
      '  ZAPL_ALL,'
      '  SC_COPY,'
      '  SCTIMEENTER,'
      '  SCDATE,'
      '  SELECT_PEOPLE'
      'from P.PDATEBIRTH '
      'where'
      '  PID = :PID')
    ModifySQL.Strings = (
      'update people'
      'set'
      ' select_people= :select_people'
      'where'
      '  pid = :OLD_pid')
    InsertSQL.Strings = (
      'null;')
    DeleteSQL.Strings = (
      'delete from P.PDATEBIRTH'
      'where'
      '  PID = :OLD_PID')
    Left = 496
    Top = 208
  end
  object sqlContrComment: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE OR INSERT INTO P_MISC_PROP  (PID, PMPCONTRNOTE)'
      'VALUES (:pid, :PMPCONTRNOTE)'
      'MATCHING (PID)')
    Transaction = DMInv.IBTransaction1
    Left = 379
    Top = 460
  end
  object sqlUpdateServiceNote: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE SERVICES S SET S.SNOTE = :SNOTE'
      'WHERE S.SCID = :SCID')
    Transaction = DMInv.IBTransaction1
    Left = 227
    Top = 732
  end
  object qChekUserForCreate: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT U.PID'
      'FROM USERS U'
      'WHERE U.PID = :PID AND U.PID IN (1, 2, 605, 787)')
    Left = 107
    Top = 596
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
  end
  object qPrintDolg: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsAgr
    SQL.Strings = (
      
        'SELECT DISTINCT SC.*, IIF (S.SCID IS NULL, 0, 1) AS ISSCAN, SD.S' +
        'DNAME AS actualn,'
      
        '    STP.*, SER.*, IIF (stp.STPERIODOPLATY = 1,'#39#1050#1074#1072#1088#1090#1072#1083' ('#1090#1088#1080' '#1084#1077#1089#1103 +
        #1094#1072').'#39', '#39#1052#1077#1089#1103#1094'.'#39') AS minperiod, SD_edizmer.SDNAME AS edizme,'
      
        '    CAST(IIF (A.AGPODRTYPE = 0, '#39#1042#1086#1089#1087#1080#1090#1072#1085#1085#1080#1082#39', '#39#1059#1095#1077#1085#1080#1082#39') AS VARC' +
        'HAR(20)) AS vospit,'
      '    CASE STP.STTYPE'
      '       WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39
      '       WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39
      '       WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39
      '    END AS tip,'
      '       IIF (STP.STTYPE <> 0,'
      '       CASE STP.STPERIODOPLATY'
      '       WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39
      '       WHEN 1 THEN '#39#1050#1074#1072#1088#1090#1072#1083#39
      '       END, '#39#1053#1077#1090#39') AS period,'
      
        '    SCPD.dolgny_zapl, (STP.STTARIF - SC.SCTARIFWITHDISCOUNT) AS ' +
        'skidka,'
      
        '    (COALESCE(SCPD.dolgny_zapl,0) - COALESCE(ZBB.zaplbb,0)) AS b' +
        'alance,'
      
        '    p1.PLASTNAME||'#39' '#39'||SUBSTRING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||' +
        ' '
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS aut' +
        'or, COALESCE(ZBB.zaplbb,0) AS zapl_all,'
      
        'IIF (SC.SCTIMEEDIT > SER.STIMEEDIT, (p3.PLASTNAME||'#39' '#39'||SUBSTRIN' +
        'G(p3.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p3.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39')), (p2.' +
        'PLASTNAME||'#39' '#39'||SUBSTRING(p2.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39'))) AS e' +
        'dit_user'
      'FROM SPEC_COND SC'
      'LEFT OUTER JOIN SERVICES SER ON SER.SCID = SC.SCID'
      'LEFT OUTER JOIN SERVICES_TYPE STP ON STP.STID = SER.STID'
      'LEFT OUTER JOIN SC_SCAN S ON S.SCID = SC.SCID'
      'LEFT OUTER JOIN SCACTUALN SCA ON SCA.SCID = SC.SCID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = SCA.SDID'
      
        'LEFT OUTER JOIN SYS_DIC SD_edizmer ON SD_edizmer.SDID = STP.STED' +
        'IZMER'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = SC.AGID'
      'LEFT OUTER JOIN USERS U ON U.USNAME = SC.SCUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = SER.SUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = SC.SCUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U2.PID'
      'LEFT OUTER JOIN'
      '('
      'SELECT GP.SCID, SUM(GP.GPAMOUNT) AS dolgny_zapl'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.GPDATE <= CURRENT_DATE'
      'GROUP BY 1) AS SCPD ON SCPD.SCID = SC.SCID'
      'LEFT OUTER JOIN'
      '('
      'SELECT SC1.SCID, SUM(COM.CAMOUNT) AS zaplbb'
      'FROM COMMON_SERV CS'
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID'
      'INNER JOIN SPEC_COND SC1 ON SC1.SCID = COM.SCID'
      'WHERE CS.CSISDELETE IS NULL'
      '     AND COM.CTYPE <> 2'
      '     AND SC1.AGID = :AGID'
      'GROUP BY 1'
      ') AS ZBB ON ZBB.SCID = SC.SCID'
      'WHERE SC.AGID = :AGID'
      'AND SC.SCISDELETE IS NULL'
      '')
    GeneratorField.Field = 'SCID'
    Left = 152
    Top = 704
    ParamData = <
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
      end>
    object IntegerField8: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object IntegerField9: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object IntegerField10: TIntegerField
      FieldName = 'AGID'
      Origin = '"SPEC_COND"."AGID"'
      Required = True
    end
    object IBStringField15: TIBStringField
      FieldName = 'SCNUMBER'
      Origin = '"SPEC_COND"."SCNUMBER"'
      Size = 40
    end
    object DateField7: TDateField
      FieldName = 'SCDATE'
      Origin = '"SPEC_COND"."SCDATE"'
    end
    object DateField8: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object IBStringField16: TIBStringField
      FieldName = 'SCNOTE'
      Origin = '"SPEC_COND"."SCNOTE"'
      Size = 255
    end
    object IBStringField17: TIBStringField
      FieldName = 'SCUSERENTER'
      Origin = '"SPEC_COND"."SCUSERENTER"'
      Size = 40
    end
    object DateTimeField4: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object IBStringField18: TIBStringField
      FieldName = 'SCUSEREDIT'
      Origin = '"SPEC_COND"."SCUSEREDIT"'
      Size = 40
    end
    object DateTimeField5: TDateTimeField
      FieldName = 'SCTIMEEDIT'
      Origin = '"SPEC_COND"."SCTIMEEDIT"'
    end
    object IntegerField11: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object IntegerField12: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object IBStringField19: TIBStringField
      FieldName = 'SCDISCOUNTAUTORISATION'
      Origin = '"SPEC_COND"."SCDISCOUNTAUTORISATION"'
      Size = 40
    end
    object DateTimeField6: TDateTimeField
      FieldName = 'SCDATEREGISTER'
      Origin = '"SPEC_COND"."SCDATEREGISTER"'
    end
    object IBStringField20: TIBStringField
      FieldName = 'SCUSERREGISTER'
      Origin = '"SPEC_COND"."SCUSERREGISTER"'
      Size = 40
    end
    object IBBCDField8: TIBBCDField
      FieldName = 'SCDISCOUNT'
      Origin = '"SPEC_COND"."SCDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IntegerField13: TIntegerField
      FieldName = 'SCTYPEOFDISCOUNT'
      Origin = '"SPEC_COND"."SCTYPEOFDISCOUNT"'
    end
    object IntegerField14: TIntegerField
      FieldName = 'SCISNEEDRESIGN'
      Origin = '"SPEC_COND"."SCISNEEDRESIGN"'
    end
    object IBStringField21: TIBStringField
      FieldName = 'SCDISCOUNTNOTE'
      Origin = '"SPEC_COND"."SCDISCOUNTNOTE"'
      Size = 255
    end
    object IBStringField22: TIBStringField
      FieldName = 'ACTUALN'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IntegerField15: TIntegerField
      FieldName = 'SCTYPEOFDISC'
      Origin = '"SPEC_COND"."SCTYPEOFDISC"'
    end
    object IntegerField16: TIntegerField
      FieldName = 'STID'
      Origin = '"SERVICES_TYPE"."STID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object IBStringField23: TIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object IntegerField17: TIntegerField
      FieldName = 'STTYPE'
      Origin = '"SERVICES_TYPE"."STTYPE"'
    end
    object IntegerField18: TIntegerField
      FieldName = 'STEDIZMER'
      Origin = '"SERVICES_TYPE"."STEDIZMER"'
    end
    object IBStringField24: TIBStringField
      FieldName = 'STDESCR'
      Origin = '"SERVICES_TYPE"."STDESCR"'
      Size = 2048
    end
    object IBBCDField9: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object DateField9: TDateField
      FieldName = 'STDATEBEGIN'
      Origin = '"SERVICES_TYPE"."STDATEBEGIN"'
    end
    object DateField10: TDateField
      FieldName = 'STDATEEND'
      Origin = '"SERVICES_TYPE"."STDATEEND"'
    end
    object TimeField1: TTimeField
      FieldName = 'STTIME'
      Origin = '"SERVICES_TYPE"."STTIME"'
    end
    object IntegerField19: TIntegerField
      FieldName = 'STPODRTYPE'
      Origin = '"SERVICES_TYPE"."STPODRTYPE"'
    end
    object IBStringField25: TIBStringField
      FieldName = 'STNOTE'
      Origin = '"SERVICES_TYPE"."STNOTE"'
      Size = 255
    end
    object IntegerField20: TIntegerField
      FieldName = 'STISARCHIVE'
      Origin = '"SERVICES_TYPE"."STISARCHIVE"'
    end
    object IntegerField21: TIntegerField
      FieldName = 'STISDELETE'
      Origin = '"SERVICES_TYPE"."STISDELETE"'
    end
    object IBStringField26: TIBStringField
      FieldName = 'STUSERENTER'
      Origin = '"SERVICES_TYPE"."STUSERENTER"'
      Size = 40
    end
    object DateTimeField7: TDateTimeField
      FieldName = 'STTIMEENTER'
      Origin = '"SERVICES_TYPE"."STTIMEENTER"'
    end
    object IBStringField27: TIBStringField
      FieldName = 'STUSEREDIT'
      Origin = '"SERVICES_TYPE"."STUSEREDIT"'
      Size = 40
    end
    object DateTimeField8: TDateTimeField
      FieldName = 'STTIMEEDIT'
      Origin = '"SERVICES_TYPE"."STTIMEEDIT"'
    end
    object DateField11: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object IBStringField28: TIBStringField
      FieldName = 'SNOTE'
      Origin = '"SERVICES"."SNOTE"'
      Size = 255
    end
    object TimeField2: TTimeField
      FieldName = 'STIMEBEGIN'
      Origin = '"SERVICES"."STIMEBEGIN"'
    end
    object TimeField3: TTimeField
      FieldName = 'STIMEEND'
      Origin = '"SERVICES"."STIMEEND"'
    end
    object IntegerField22: TIntegerField
      FieldName = 'SCMINPERIOD'
      Origin = '"SPEC_COND"."SCMINPERIOD"'
    end
    object IntegerField23: TIntegerField
      FieldName = 'SCOUNT'
      Origin = '"SERVICES"."SCOUNT"'
    end
    object IBStringField29: TIBStringField
      FieldName = 'EDIZME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IBBCDField10: TIBBCDField
      FieldName = 'SCTARIF'
      Origin = '"SPEC_COND"."SCTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBBCDField11: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IBBCDField12: TIBBCDField
      FieldName = 'SCAMOUNT'
      Origin = '"SPEC_COND"."SCAMOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IBBCDField13: TIBBCDField
      FieldName = 'SCBALANCE'
      Origin = '"SPEC_COND"."SCBALANCE"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IntegerField24: TIntegerField
      FieldName = 'SCDATARASCH'
      Origin = '"SPEC_COND"."SCDATARASCH"'
    end
    object IBStringField30: TIBStringField
      FieldName = 'MINPERIOD'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IBStringField31: TIBStringField
      FieldName = 'VOSPIT'
      ProviderFlags = []
      FixedChar = True
      Size = 11
    end
    object IntegerField25: TIntegerField
      FieldName = 'SDID'
      Origin = '"SERVICES_TYPE"."SDID"'
    end
    object IBStringField32: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 9
    end
    object IBStringField33: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      FixedChar = True
      Size = 7
    end
    object IBBCDField14: TIBBCDField
      FieldName = 'DOLGNY_ZAPL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBBCDField15: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBBCDField16: TIBBCDField
      FieldName = 'BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBStringField34: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object DateField12: TDateField
      FieldName = 'SCDATERASTORJ'
      Origin = '"SPEC_COND"."SCDATERASTORJ"'
    end
    object IBBCDField17: TIBBCDField
      FieldName = 'ZAPL_ALL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBStringField35: TIBStringField
      FieldName = 'EDIT_USER'
      ProviderFlags = []
      Size = 769
    end
  end
  object sqlInsertPodpisant: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'INSERT INTO dov_litsa (pid, pid_poluch, dlstatus)'
      'SELECT DISTINCT ap.pid, cast(:PID as INTEGER), ap.postatus'
      'FROM agr_poluch_uslug apu'
      'INNER JOIN agr_podpisant ap on ap.agid = apu.agid'
      'WHERE apu.pid = :pid and ap.ID_JURIDICAL_FACE is null')
    Transaction = DMInv.IBTransaction1
    Left = 465
    Top = 459
  end
  object qPrintDolgTemp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT DISTINCT SC.*, IIF (S.SCID IS NULL, 0, 1) AS ISSCAN, SD.S' +
        'DNAME AS actualn,'
      
        '    STP.*, SER.*, IIF (stp.STPERIODOPLATY = 1,'#39#1050#1074#1072#1088#1090#1072#1083' ('#1090#1088#1080' '#1084#1077#1089#1103 +
        #1094#1072').'#39', '#39#1052#1077#1089#1103#1094'.'#39') AS minperiod, SD_edizmer.SDNAME AS edizme,'
      
        '    CAST(IIF (A.AGPODRTYPE = 0, '#39#1042#1086#1089#1087#1080#1090#1072#1085#1085#1080#1082#39', '#39#1059#1095#1077#1085#1080#1082#39') AS VARC' +
        'HAR(20)) AS vospit,'
      '    CASE STP.STTYPE'
      '       WHEN 0 THEN '#39#1056#1072#1079#1086#1074#1072#1103#39
      '       WHEN 1 THEN '#39#1054#1089#1085#1086#1074#1085'.'#39
      '       WHEN 2 THEN '#39#1044#1086#1087#1086#1083#1085#1080#1090'.'#39
      '    END AS tip,'
      '       IIF (STP.STTYPE <> 0,'
      '       CASE STP.STPERIODOPLATY'
      '       WHEN 0 THEN '#39#1052#1077#1089#1103#1094#39
      '       WHEN 1 THEN '#39#1050#1074#1072#1088#1090#1072#1083#39
      '       END, '#39#1053#1077#1090#39') AS period,'
      
        '    SCPD.dolgny_zapl, (STP.STTARIF - SC.SCTARIFWITHDISCOUNT) AS ' +
        'skidka,'
      
        '    (COALESCE(SCPD.dolgny_zapl,0) - COALESCE(ZBB.zaplbb,0)) AS b' +
        'alance,'
      
        '    p1.PLASTNAME||'#39' '#39'||SUBSTRING(p1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||' +
        ' '
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS aut' +
        'or, COALESCE(ZBB.zaplbb,0) AS zapl_all,'
      
        'IIF (SC.SCTIMEEDIT > SER.STIMEEDIT, (p3.PLASTNAME||'#39' '#39'||SUBSTRIN' +
        'G(p3.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p3.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39')), (p2.' +
        'PLASTNAME||'#39' '#39'||SUBSTRING(p2.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39'))) AS e' +
        'dit_user'
      'FROM SPEC_COND SC'
      'LEFT OUTER JOIN SERVICES SER ON SER.SCID = SC.SCID'
      'LEFT OUTER JOIN SERVICES_TYPE STP ON STP.STID = SER.STID'
      'LEFT OUTER JOIN SC_SCAN S ON S.SCID = SC.SCID'
      'LEFT OUTER JOIN SCACTUALN SCA ON SCA.SCID = SC.SCID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = SCA.SDID'
      
        'LEFT OUTER JOIN SYS_DIC SD_edizmer ON SD_edizmer.SDID = STP.STED' +
        'IZMER'
      'LEFT OUTER JOIN AGREEMENTS A ON A.AGID = SC.AGID'
      'LEFT OUTER JOIN USERS U ON U.USNAME = SC.SCUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = SER.SUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = SC.SCUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U2.PID'
      'LEFT OUTER JOIN'
      '('
      'SELECT GP.SCID, SUM(GP.GPAMOUNT) AS dolgny_zapl'
      'FROM SC_GRAFPLAT GP'
      'WHERE GP.GPDATE <= CURRENT_DATE'
      'GROUP BY 1) AS SCPD ON SCPD.SCID = SC.SCID'
      'LEFT OUTER JOIN'
      '('
      'SELECT SC1.SCID, SUM(COM.CAMOUNT) AS zaplbb'
      'FROM COMMON_SERV CS'
      'INNER JOIN COMMON COM ON COM.CSID = CS.CSID'
      'INNER JOIN SPEC_COND SC1 ON SC1.SCID = COM.SCID'
      'WHERE CS.CSISDELETE IS NULL'
      '     AND COM.CTYPE <> 2'
      '     AND SC1.AGID = :AGID'
      'GROUP BY 1'
      ') AS ZBB ON ZBB.SCID = SC.SCID'
      'WHERE SC.AGID = :AGID'
      'AND SC.SCISDELETE IS NULL'
      '')
    GeneratorField.Field = 'SCID'
    Left = 152
    Top = 736
    ParamData = <
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'AGID'
        ParamType = ptUnknown
      end>
    object IntegerField26: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object IntegerField27: TIntegerField
      FieldName = 'SCNUM_N'
      Origin = '"SPEC_COND"."SCNUM_N"'
    end
    object IntegerField28: TIntegerField
      FieldName = 'AGID'
      Origin = '"SPEC_COND"."AGID"'
      Required = True
    end
    object IBStringField36: TIBStringField
      FieldName = 'SCNUMBER'
      Origin = '"SPEC_COND"."SCNUMBER"'
      Size = 40
    end
    object DateField13: TDateField
      FieldName = 'SCDATE'
      Origin = '"SPEC_COND"."SCDATE"'
    end
    object DateField14: TDateField
      FieldName = 'SCDATEEND'
      Origin = '"SPEC_COND"."SCDATEEND"'
    end
    object IBStringField37: TIBStringField
      FieldName = 'SCNOTE'
      Origin = '"SPEC_COND"."SCNOTE"'
      Size = 255
    end
    object IBStringField38: TIBStringField
      FieldName = 'SCUSERENTER'
      Origin = '"SPEC_COND"."SCUSERENTER"'
      Size = 40
    end
    object DateTimeField9: TDateTimeField
      FieldName = 'SCTIMEENTER'
      Origin = '"SPEC_COND"."SCTIMEENTER"'
    end
    object IBStringField39: TIBStringField
      FieldName = 'SCUSEREDIT'
      Origin = '"SPEC_COND"."SCUSEREDIT"'
      Size = 40
    end
    object DateTimeField10: TDateTimeField
      FieldName = 'SCTIMEEDIT'
      Origin = '"SPEC_COND"."SCTIMEEDIT"'
    end
    object IntegerField29: TIntegerField
      FieldName = 'SCISDELETE'
      Origin = '"SPEC_COND"."SCISDELETE"'
    end
    object IntegerField30: TIntegerField
      FieldName = 'ISSCAN'
      ProviderFlags = []
    end
    object IBStringField40: TIBStringField
      FieldName = 'SCDISCOUNTAUTORISATION'
      Origin = '"SPEC_COND"."SCDISCOUNTAUTORISATION"'
      Size = 40
    end
    object DateTimeField11: TDateTimeField
      FieldName = 'SCDATEREGISTER'
      Origin = '"SPEC_COND"."SCDATEREGISTER"'
    end
    object IBStringField41: TIBStringField
      FieldName = 'SCUSERREGISTER'
      Origin = '"SPEC_COND"."SCUSERREGISTER"'
      Size = 40
    end
    object IBBCDField18: TIBBCDField
      FieldName = 'SCDISCOUNT'
      Origin = '"SPEC_COND"."SCDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IntegerField31: TIntegerField
      FieldName = 'SCTYPEOFDISCOUNT'
      Origin = '"SPEC_COND"."SCTYPEOFDISCOUNT"'
    end
    object IntegerField32: TIntegerField
      FieldName = 'SCISNEEDRESIGN'
      Origin = '"SPEC_COND"."SCISNEEDRESIGN"'
    end
    object IBStringField42: TIBStringField
      FieldName = 'SCDISCOUNTNOTE'
      Origin = '"SPEC_COND"."SCDISCOUNTNOTE"'
      Size = 255
    end
    object IBStringField43: TIBStringField
      FieldName = 'ACTUALN'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IntegerField33: TIntegerField
      FieldName = 'SCTYPEOFDISC'
      Origin = '"SPEC_COND"."SCTYPEOFDISC"'
    end
    object IntegerField34: TIntegerField
      FieldName = 'STID'
      Origin = '"SERVICES_TYPE"."STID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object IBStringField44: TIBStringField
      DisplayLabel = #1059#1089#1083#1091#1075#1072
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object IntegerField35: TIntegerField
      FieldName = 'STTYPE'
      Origin = '"SERVICES_TYPE"."STTYPE"'
    end
    object IntegerField36: TIntegerField
      FieldName = 'STEDIZMER'
      Origin = '"SERVICES_TYPE"."STEDIZMER"'
    end
    object IBStringField45: TIBStringField
      FieldName = 'STDESCR'
      Origin = '"SERVICES_TYPE"."STDESCR"'
      Size = 2048
    end
    object IBBCDField19: TIBBCDField
      FieldName = 'STTARIF'
      Origin = '"SERVICES_TYPE"."STTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object DateField15: TDateField
      FieldName = 'STDATEBEGIN'
      Origin = '"SERVICES_TYPE"."STDATEBEGIN"'
    end
    object DateField16: TDateField
      FieldName = 'STDATEEND'
      Origin = '"SERVICES_TYPE"."STDATEEND"'
    end
    object TimeField4: TTimeField
      FieldName = 'STTIME'
      Origin = '"SERVICES_TYPE"."STTIME"'
    end
    object IntegerField37: TIntegerField
      FieldName = 'STPODRTYPE'
      Origin = '"SERVICES_TYPE"."STPODRTYPE"'
    end
    object IBStringField46: TIBStringField
      FieldName = 'STNOTE'
      Origin = '"SERVICES_TYPE"."STNOTE"'
      Size = 255
    end
    object IntegerField38: TIntegerField
      FieldName = 'STISARCHIVE'
      Origin = '"SERVICES_TYPE"."STISARCHIVE"'
    end
    object IntegerField39: TIntegerField
      FieldName = 'STISDELETE'
      Origin = '"SERVICES_TYPE"."STISDELETE"'
    end
    object IBStringField47: TIBStringField
      FieldName = 'STUSERENTER'
      Origin = '"SERVICES_TYPE"."STUSERENTER"'
      Size = 40
    end
    object DateTimeField12: TDateTimeField
      FieldName = 'STTIMEENTER'
      Origin = '"SERVICES_TYPE"."STTIMEENTER"'
    end
    object IBStringField48: TIBStringField
      FieldName = 'STUSEREDIT'
      Origin = '"SERVICES_TYPE"."STUSEREDIT"'
      Size = 40
    end
    object DateTimeField13: TDateTimeField
      FieldName = 'STTIMEEDIT'
      Origin = '"SERVICES_TYPE"."STTIMEEDIT"'
    end
    object DateField17: TDateField
      FieldName = 'SCDATEBEGIN'
      Origin = '"SPEC_COND"."SCDATEBEGIN"'
    end
    object IBStringField49: TIBStringField
      FieldName = 'SNOTE'
      Origin = '"SERVICES"."SNOTE"'
      Size = 255
    end
    object TimeField5: TTimeField
      FieldName = 'STIMEBEGIN'
      Origin = '"SERVICES"."STIMEBEGIN"'
    end
    object TimeField6: TTimeField
      FieldName = 'STIMEEND'
      Origin = '"SERVICES"."STIMEEND"'
    end
    object IntegerField40: TIntegerField
      FieldName = 'SCMINPERIOD'
      Origin = '"SPEC_COND"."SCMINPERIOD"'
    end
    object IntegerField41: TIntegerField
      FieldName = 'SCOUNT'
      Origin = '"SERVICES"."SCOUNT"'
    end
    object IBStringField50: TIBStringField
      FieldName = 'EDIZME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IBBCDField20: TIBBCDField
      FieldName = 'SCTARIF'
      Origin = '"SPEC_COND"."SCTARIF"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBBCDField21: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IBBCDField22: TIBBCDField
      FieldName = 'SCAMOUNT'
      Origin = '"SPEC_COND"."SCAMOUNT"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IBBCDField23: TIBBCDField
      FieldName = 'SCBALANCE'
      Origin = '"SPEC_COND"."SCBALANCE"'
      DisplayFormat = '#,###0'
      EditFormat = '0'
      Precision = 18
      Size = 2
    end
    object IntegerField42: TIntegerField
      FieldName = 'SCDATARASCH'
      Origin = '"SPEC_COND"."SCDATARASCH"'
    end
    object IBStringField51: TIBStringField
      FieldName = 'MINPERIOD'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object IBStringField52: TIBStringField
      FieldName = 'VOSPIT'
      ProviderFlags = []
      FixedChar = True
      Size = 11
    end
    object IntegerField43: TIntegerField
      FieldName = 'SDID'
      Origin = '"SERVICES_TYPE"."SDID"'
    end
    object IBStringField53: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 9
    end
    object IBStringField54: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      FixedChar = True
      Size = 7
    end
    object IBBCDField24: TIBBCDField
      FieldName = 'DOLGNY_ZAPL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBBCDField25: TIBBCDField
      FieldName = 'SKIDKA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBBCDField26: TIBBCDField
      FieldName = 'BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBStringField55: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object DateField18: TDateField
      FieldName = 'SCDATERASTORJ'
      Origin = '"SPEC_COND"."SCDATERASTORJ"'
    end
    object IBBCDField27: TIBBCDField
      FieldName = 'ZAPL_ALL'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object IBStringField56: TIBStringField
      FieldName = 'EDIT_USER'
      ProviderFlags = []
      Size = 769
    end
  end
  object qPID_poluch: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT r.pid'
      'FROM rodstvennik r'
      'WHERE (r.rid IN (SELECT DISTINCT r1.rid'
      '                 FROM rodstvennik r1'
      '                 WHERE r1.pid = :pid)) AND'
      '      EXISTS(SELECT dl.pid_poluch'
      '             FROM dov_litsa dl'
      '             WHERE dl.pid_poluch = r.pid)   ')
    Left = 1187
    Top = 764
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qPID_poluchPID: TIntegerField
      FieldName = 'PID'
      Origin = '"RODSTVENNIK"."PID"'
      Required = True
    end
  end
  object qKPPMessages: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qKPPMessagesAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT KM.*'
      'FROM KPP_MESSAGES KM'
      'WHERE KM.PID = :pid')
    UpdateObject = quKPPMessages
    GeneratorField.Field = 'KMID'
    GeneratorField.Generator = 'GEN_KPP_MESSAGES_ID'
    Left = 672
    Top = 552
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qKPPMessagesKMID: TIntegerField
      FieldName = 'KMID'
      Origin = '"KPP_MESSAGES"."KMID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qKPPMessagesPID: TIntegerField
      FieldName = 'PID'
      Origin = '"KPP_MESSAGES"."PID"'
      Required = True
    end
    object qKPPMessagesKMMESSAGE: TIBStringField
      FieldName = 'KMMESSAGE'
      Origin = '"KPP_MESSAGES"."KMMESSAGE"'
      Size = 2048
    end
    object qKPPMessagesKMDATEBEGIN: TDateTimeField
      FieldName = 'KMDATEBEGIN'
      Origin = '"KPP_MESSAGES"."KMDATEBEGIN"'
    end
    object qKPPMessagesKMDATEEND: TDateTimeField
      FieldName = 'KMDATEEND'
      Origin = '"KPP_MESSAGES"."KMDATEEND"'
    end
    object qKPPMessagesKMUSLOVIE: TIBStringField
      FieldName = 'KMUSLOVIE'
      Origin = '"KPP_MESSAGES"."KMUSLOVIE"'
      Size = 40
    end
    object qKPPMessagesKMDEJSTVIE: TIntegerField
      FieldName = 'KMDEJSTVIE'
      Origin = '"KPP_MESSAGES"."KMDEJSTVIE"'
    end
    object qKPPMessagesKMUSERENTER: TIBStringField
      FieldName = 'KMUSERENTER'
      Origin = '"KPP_MESSAGES"."KMUSERENTER"'
      Size = 40
    end
    object qKPPMessagesKMTIMEENTER: TDateTimeField
      FieldName = 'KMTIMEENTER'
      Origin = '"KPP_MESSAGES"."KMTIMEENTER"'
    end
    object qKPPMessagesKMUSEREDIT: TIBStringField
      FieldName = 'KMUSEREDIT'
      Origin = '"KPP_MESSAGES"."KMUSEREDIT"'
      Size = 40
    end
    object qKPPMessagesKMTIMEEDIT: TDateTimeField
      FieldName = 'KMTIMEEDIT'
      Origin = '"KPP_MESSAGES"."KMTIMEEDIT"'
    end
  end
  object quKPPMessages: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  KMID,'
      '  PID,'
      '  KMMESSAGE,'
      '  KMDATEBEGIN,'
      '  KMDATEEND,'
      '  KMUSLOVIE,'
      '  KMDEJSTVIE,'
      '  KMUSERENTER,'
      '  KMTIMEENTER,'
      '  KMUSEREDIT,'
      '  KMTIMEEDIT'
      'from KPP_MESSAGES '
      'where'
      '  KMID = :KMID')
    ModifySQL.Strings = (
      'update KPP_MESSAGES'
      'set'
      '  KMDATEBEGIN = :KMDATEBEGIN,'
      '  KMDATEEND = :KMDATEEND,'
      '  KMDEJSTVIE = :KMDEJSTVIE,'
      '  KMID = :KMID,'
      '  KMMESSAGE = :KMMESSAGE,'
      '  KMTIMEEDIT = :KMTIMEEDIT,'
      '  KMTIMEENTER = :KMTIMEENTER,'
      '  KMUSEREDIT = :KMUSEREDIT,'
      '  KMUSERENTER = :KMUSERENTER,'
      '  KMUSLOVIE = :KMUSLOVIE,'
      '  PID = :PID'
      'where'
      '  KMID = :OLD_KMID')
    InsertSQL.Strings = (
      'insert into KPP_MESSAGES'
      
        '  (KMDATEBEGIN, KMDATEEND, KMDEJSTVIE, KMID, KMMESSAGE, KMTIMEED' +
        'IT, KMTIMEENTER, '
      '   KMUSEREDIT, KMUSERENTER, KMUSLOVIE, PID)'
      'values'
      
        '  (:KMDATEBEGIN, :KMDATEEND, :KMDEJSTVIE, :KMID, :KMMESSAGE, :KM' +
        'TIMEEDIT, '
      '   :KMTIMEENTER, :KMUSEREDIT, :KMUSERENTER, :KMUSLOVIE, :PID)')
    DeleteSQL.Strings = (
      'delete from KPP_MESSAGES'
      'where'
      '  KMID = :OLD_KMID')
    Left = 696
    Top = 552
  end
  object dsKPPMessages: TDataSource
    DataSet = qKPPMessages
    Left = 640
    Top = 552
  end
  object qOsnPodr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qOsnPodrAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT DP.*, SD.SDNAME AS osn_podr,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS redaktor,'
      'COALESCE(dp.DPTIMEEDIT, dp.DPTIMEENTER) AS t_red'
      'FROM DETI_PODRAZD DP'
      'INNER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      
        'LEFT OUTER JOIN USERS U ON U.USNAME =  COALESCE(DP.DPUSEREDIT, D' +
        'P.DPUSERENTER)'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID'
      'WHERE DP.PID = :PID')
    UpdateObject = quOsnPodr
    GeneratorField.Field = 'DPID'
    GeneratorField.Generator = 'GEN_DETI_PODRAZD_ID'
    Left = 1051
    Top = 540
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qOsnPodrDPID: TIntegerField
      FieldName = 'DPID'
      Origin = '"DETI_PODRAZD"."DPID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qOsnPodrPID: TIntegerField
      FieldName = 'PID'
      Origin = '"DETI_PODRAZD"."PID"'
    end
    object qOsnPodrSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"DETI_PODRAZD"."SDID"'
    end
    object qOsnPodrDPDATEIN: TDateTimeField
      FieldName = 'DPDATEIN'
      Origin = '"DETI_PODRAZD"."DPDATEIN"'
    end
    object qOsnPodrINNOTE: TIBStringField
      FieldName = 'INNOTE'
      Origin = '"DETI_PODRAZD"."INNOTE"'
      Size = 255
    end
    object qOsnPodrDPDATEOUT: TDateTimeField
      FieldName = 'DPDATEOUT'
      Origin = '"DETI_PODRAZD"."DPDATEOUT"'
    end
    object qOsnPodrOUTNOTE: TIBStringField
      FieldName = 'OUTNOTE'
      Origin = '"DETI_PODRAZD"."OUTNOTE"'
      Size = 255
    end
    object qOsnPodrDPUSERENTER: TIBStringField
      FieldName = 'DPUSERENTER'
      Origin = '"DETI_PODRAZD"."DPUSERENTER"'
      Size = 40
    end
    object qOsnPodrDPTIMEENTER: TDateTimeField
      FieldName = 'DPTIMEENTER'
      Origin = '"DETI_PODRAZD"."DPTIMEENTER"'
    end
    object qOsnPodrDPUSEREDIT: TIBStringField
      FieldName = 'DPUSEREDIT'
      Origin = '"DETI_PODRAZD"."DPUSEREDIT"'
      Size = 40
    end
    object qOsnPodrDPTIMEEDIT: TDateTimeField
      FieldName = 'DPTIMEEDIT'
      Origin = '"DETI_PODRAZD"."DPTIMEEDIT"'
    end
    object qOsnPodrOSN_PODR: TIBStringField
      FieldName = 'OSN_PODR'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qOsnPodrREDAKTOR: TIBStringField
      FieldName = 'REDAKTOR'
      ProviderFlags = []
      Size = 769
    end
    object qOsnPodrT_RED: TDateTimeField
      FieldName = 'T_RED'
      ProviderFlags = []
    end
  end
  object dsOsnPodr: TDataSource
    DataSet = qOsnPodr
    Left = 1019
    Top = 540
  end
  object quOsnPodr: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  DPID,'
      '  PID,'
      '  SDID,'
      '  DPDATEIN,'
      '  INNOTE,'
      '  DPDATEOUT,'
      '  OUTNOTE,'
      '  DPUSERENTER,'
      '  DPTIMEENTER,'
      '  DPUSEREDIT,'
      '  DPTIMEEDIT,'
      '  OSN_PODR'
      'from DETI_PODRAZD '
      'where'
      '  DPID = :DPID')
    ModifySQL.Strings = (
      'update DETI_PODRAZD'
      'set'
      '  DPDATEIN = :DPDATEIN,'
      '  DPDATEOUT = :DPDATEOUT,'
      '  DPID = :DPID,'
      '  INNOTE = :INNOTE,'
      '  OUTNOTE = :OUTNOTE,'
      '  PID = :PID,'
      '  SDID = :SDID'
      'where'
      '  DPID = :OLD_DPID')
    InsertSQL.Strings = (
      'insert into DETI_PODRAZD'
      '  (DPDATEIN, DPDATEOUT, DPID, INNOTE, OUTNOTE, PID, SDID)'
      'values'
      '  (:DPDATEIN, :DPDATEOUT, :DPID, :INNOTE, :OUTNOTE, :PID, :SDID)')
    DeleteSQL.Strings = (
      'delete from DETI_PODRAZD'
      'where'
      '  DPID = :OLD_DPID')
    Left = 1091
    Top = 540
  end
  object dsDopPodr: TDataSource
    DataSet = qDopPodr
    Left = 1019
    Top = 564
  end
  object qDopPodr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qDopPodrAfterInsert
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT DP.*, SD.SDNAME AS osn_podr,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS redaktor,'
      'COALESCE(dp.DPTIMEEDIT, dp.DPTIMEENTER) AS t_red'
      'FROM DETI_PODRAZD_MISC  DP'
      'INNER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      
        'LEFT OUTER JOIN USERS U ON U.USNAME =  COALESCE(DP.DPUSEREDIT, D' +
        'P.DPUSERENTER)'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U.PID'
      'WHERE DP.PID = :PID')
    UpdateObject = quDopPodr
    GeneratorField.Field = 'DPID'
    GeneratorField.Generator = 'GEN_DETI_PODRAZD_MISC_ID'
    Left = 1051
    Top = 564
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qDopPodrDPID: TIntegerField
      FieldName = 'DPID'
      Origin = '"DETI_PODRAZD_MISC"."DPID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qDopPodrPID: TIntegerField
      FieldName = 'PID'
      Origin = '"DETI_PODRAZD_MISC"."PID"'
    end
    object qDopPodrSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"DETI_PODRAZD_MISC"."SDID"'
    end
    object qDopPodrDPDATEIN: TDateTimeField
      FieldName = 'DPDATEIN'
      Origin = '"DETI_PODRAZD_MISC"."DPDATEIN"'
    end
    object qDopPodrINNOTE: TIBStringField
      FieldName = 'INNOTE'
      Origin = '"DETI_PODRAZD_MISC"."INNOTE"'
      Size = 255
    end
    object qDopPodrDPDATEOUT: TDateTimeField
      FieldName = 'DPDATEOUT'
      Origin = '"DETI_PODRAZD_MISC"."DPDATEOUT"'
    end
    object qDopPodrOUTNOTE: TIBStringField
      FieldName = 'OUTNOTE'
      Origin = '"DETI_PODRAZD_MISC"."OUTNOTE"'
      Size = 255
    end
    object qDopPodrDPUSERENTER: TIBStringField
      FieldName = 'DPUSERENTER'
      Origin = '"DETI_PODRAZD_MISC"."DPUSERENTER"'
      Size = 40
    end
    object qDopPodrDPTIMEENTER: TDateTimeField
      FieldName = 'DPTIMEENTER'
      Origin = '"DETI_PODRAZD_MISC"."DPTIMEENTER"'
    end
    object qDopPodrDPUSEREDIT: TIBStringField
      FieldName = 'DPUSEREDIT'
      Origin = '"DETI_PODRAZD_MISC"."DPUSEREDIT"'
      Size = 40
    end
    object qDopPodrDPTIMEEDIT: TDateTimeField
      FieldName = 'DPTIMEEDIT'
      Origin = '"DETI_PODRAZD_MISC"."DPTIMEEDIT"'
    end
    object qDopPodrOSN_PODR: TIBStringField
      FieldName = 'OSN_PODR'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qDopPodrREDAKTOR: TIBStringField
      FieldName = 'REDAKTOR'
      ProviderFlags = []
      Size = 769
    end
    object qDopPodrT_RED: TDateTimeField
      FieldName = 'T_RED'
      ProviderFlags = []
    end
  end
  object quDopPodr: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  DPID,'
      '  PID,'
      '  SDID,'
      '  DPDATEIN,'
      '  INNOTE,'
      '  DPDATEOUT,'
      '  OUTNOTE,'
      '  DPUSERENTER,'
      '  DPTIMEENTER,'
      '  DPUSEREDIT,'
      '  DPTIMEEDIT,'
      '  OSN_PODR'
      'from DETI_PODRAZD_MISC '
      'where'
      '  DPID = :DPID')
    ModifySQL.Strings = (
      'update DETI_PODRAZD_MISC'
      'set'
      '  DPDATEIN = :DPDATEIN,'
      '  DPDATEOUT = :DPDATEOUT,'
      '  DPID = :DPID,'
      '  INNOTE = :INNOTE,'
      '  OUTNOTE = :OUTNOTE,'
      '  PID = :PID,'
      '  SDID = :SDID'
      'where'
      '  DPID = :OLD_DPID')
    InsertSQL.Strings = (
      'insert into DETI_PODRAZD_MISC'
      '  (DPDATEIN, DPDATEOUT, DPID, INNOTE, OUTNOTE, PID, SDID)'
      'values'
      '  (:DPDATEIN, :DPDATEOUT, :DPID, :INNOTE, :OUTNOTE, :PID, :SDID)')
    DeleteSQL.Strings = (
      'delete from DETI_PODRAZD_MISC'
      'where'
      '  DPID = :OLD_DPID')
    Left = 1091
    Top = 564
  end
  object qAdresPU: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterInsert = qContInfoAfterInsert
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT CI.*, SD.SDNAME,'
      
        'IIF (ci.CITYPE IN (1151, 1152, 1153), COALESCE(k.NAME||'#39' , '#39'||ks' +
        '.NAME||'#39' , '#39'||ci.CIVALUE, ci.CIVALUE), ci.CIVALUE) AS CONTACT'
      'FROM CONTACTINFO CI'
      'INNER JOIN SYS_DIC SD ON SD.SDID = CI.CITYPE'
      'LEFT OUTER JOIN KLADR_STREET_MO ks ON ks.KSID = CI.KSID'
      'LEFT OUTER JOIN KLADR_MO k ON k.KID = ci.KID'
      'WHERE CI.PID = :PID and CI.citype = 1153')
    GeneratorField.Field = 'CIID'
    Left = 936
    Top = 608
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qAdresPUCONTACT: TIBStringField
      FieldName = 'CONTACT'
      ProviderFlags = []
      Size = 421
    end
  end
  object dsAdresPU: TDataSource
    DataSet = qAdresPU
    Left = 859
    Top = 612
  end
  object qRS: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT RS.*, SD.SDNAME AS usluga, p1.PLASTNAME||'#39' '#39'||SUBSTRING(p' +
        '1.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p1.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS ped' +
        'agog_fio,'
      'p2.PLASTNAME||'#39' '#39'||SUBSTRING(p2.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p2.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS adm' +
        '_fio,'
      'p3.PLASTNAME||'#39' '#39'||SUBSTRING(p3.PNAME FROM 1 FOR 1 )||'#39'. '#39'||'
      
        'COALESCE(SUBSTRING(p3.PPATRONYMIC FROM 1 FOR 1)||'#39'.'#39','#39' '#39') AS reg' +
        'istrator_fio'
      'FROM RS_PEOPLE  RSP'
      'LEFT OUTER JOIN RENDERING_SERVICES RS ON RS.RSID = RSP.RSID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = RS.SDID'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = RS.PID_PEDAG'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = RS.PID_ADM'
      'LEFT OUTER JOIN USERS U ON U.USNAME = RS.RSUSERENTER'
      'LEFT OUTER JOIN PEOPLE P3 ON P3.PID = U.PID'
      'WHERE RSP.PID = :PID'
      'and (coalesce(RS.rsisdelete, 0) = 0)'
      'AND (coalesce(RSP.RSPISDELETE, 0) = 0)')
    GeneratorField.Field = 'RSID'
    Left = 832
    Top = 660
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qRSRSID: TIntegerField
      FieldName = 'RSID'
      Origin = '"RENDERING_SERVICES"."RSID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qRSSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"RENDERING_SERVICES"."SDID"'
    end
    object qRSPID_PEDAG: TIntegerField
      FieldName = 'PID_PEDAG'
      Origin = '"RENDERING_SERVICES"."PID_PEDAG"'
    end
    object qRSPID_ADM: TIntegerField
      FieldName = 'PID_ADM'
      Origin = '"RENDERING_SERVICES"."PID_ADM"'
    end
    object qRSRSDATE: TDateField
      FieldName = 'RSDATE'
      Origin = '"RENDERING_SERVICES"."RSDATE"'
    end
    object qRSRSTIMEBEGIN: TTimeField
      FieldName = 'RSTIMEBEGIN'
      Origin = '"RENDERING_SERVICES"."RSTIMEBEGIN"'
    end
    object qRSRSTIMEEND: TTimeField
      FieldName = 'RSTIMEEND'
      Origin = '"RENDERING_SERVICES"."RSTIMEEND"'
    end
    object qRSRSTEMA: TIBStringField
      FieldName = 'RSTEMA'
      Origin = '"RENDERING_SERVICES"."RSTEMA"'
      Size = 2048
    end
    object qRSRSNABLJUD: TIBStringField
      FieldName = 'RSNABLJUD'
      Origin = '"RENDERING_SERVICES"."RSNABLJUD"'
      Size = 2048
    end
    object qRSRSTIMEENTER: TDateTimeField
      FieldName = 'RSTIMEENTER'
      Origin = '"RENDERING_SERVICES"."RSTIMEENTER"'
    end
    object qRSRSUSERENTER: TIBStringField
      FieldName = 'RSUSERENTER'
      Origin = '"RENDERING_SERVICES"."RSUSERENTER"'
      Size = 40
    end
    object qRSRSTIMEEDIT: TDateTimeField
      FieldName = 'RSTIMEEDIT'
      Origin = '"RENDERING_SERVICES"."RSTIMEEDIT"'
    end
    object qRSRSUSEREDIT: TIBStringField
      FieldName = 'RSUSEREDIT'
      Origin = '"RENDERING_SERVICES"."RSUSEREDIT"'
      Size = 40
    end
    object qRSRSISDELETE: TIntegerField
      FieldName = 'RSISDELETE'
      Origin = '"RENDERING_SERVICES"."RSISDELETE"'
    end
    object qRSUSLUGA: TIBStringField
      FieldName = 'USLUGA'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qRSPEDAGOG_FIO: TIBStringField
      FieldName = 'PEDAGOG_FIO'
      ProviderFlags = []
      Size = 769
    end
    object qRSADM_FIO: TIBStringField
      FieldName = 'ADM_FIO'
      ProviderFlags = []
      Size = 769
    end
    object qRSREGISTRATOR_FIO: TIBStringField
      FieldName = 'REGISTRATOR_FIO'
      ProviderFlags = []
      Size = 769
    end
  end
  object dsRS: TDataSource
    DataSet = qRS
    Left = 795
    Top = 660
  end
  object sqlUpdateRSP: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE RS_PEOPLE RSP'
      'SET RSP.RSPISDELETE = 1'
      'WHERE RSP.RSID = :RSID'
      '    AND RSP.PID = :PID')
    Transaction = DMInv.IBTransaction1
    Left = 867
    Top = 660
  end
  object qPrintGrafik: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT *'
      'FROM sp_kpp_printgrafplat(:pid)')
    GeneratorField.Field = 'SCID'
    Left = 192
    Top = 736
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qPrintGrafikSTNAME: TIBStringField
      FieldName = 'STNAME'
      Origin = '"SP_KPP_PRINTGRAFPLAT"."STNAME"'
      Size = 255
    end
    object qPrintGrafikGPDATE: TDateField
      FieldName = 'GPDATE'
      Origin = '"SP_KPP_PRINTGRAFPLAT"."GPDATE"'
    end
    object qPrintGrafikGPAMOUNT: TIBBCDField
      FieldName = 'GPAMOUNT'
      Origin = '"SP_KPP_PRINTGRAFPLAT"."GPAMOUNT"'
      Precision = 18
      Size = 2
    end
  end
  object qMessage: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT A.AGID AS skvN, CAST('#39#1053#1077#1090' '#1082#1086#1087#1080#1080' '#1076#1086#1075#1086#1074#1086#1088#1072#39' AS VARCHAR(255)' +
        ') AS mes'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE APU.PID = :PID_POLUCH'
      '    AND A.AGISDELETE IS NULL'
      '    AND COALESCE(a.AGDATECLOSE, a.AGDATEEND)  >= CURRENT_DATE'
      '    AND NOT EXISTS'
      '    ('
      '     SELECT As1.AGID'
      '     FROM A_SCAN AS1'
      '     WHERE AS1.AGID = A.AGID'
      '    )'
      'UNION'
      
        'SELECT A.AGID AS skvN, CAST('#39#1053#1077#1086#1073#1093#1086#1076#1080#1084#1086' '#1087#1077#1088#1077#1087#1086#1076#1087#1080#1089#1072#1090#1100' '#1076#1086#1075#1086#1074#1086#1088', '#1090 +
        '.'#1082'. '#1077#1075#1086' '#1092#1086#1088#1084#1072' '#1091#1089#1090#1072#1088#1077#1083#1072#39' AS VARCHAR(255)) AS mes'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE APU.PID = :PID_POLUCH'
      '    AND A.AGISDELETE IS NULL'
      '    AND CURRENT_DATE BETWEEN A.AGDATEBEGIN AND A.AGDATEEND'
      '    AND EXISTS'
      '    ('
      '     SELECT As1.AGID'
      '     FROM A_SCAN AS1'
      '     WHERE AS1.AGID = A.AGID'
      
        '     AND COALESCE(AS1.ASTIMEEDIT, AS1.ASTIMEENTER) < '#39'01.03.2011' +
        #39
      '    )'
      'UNION'
      
        'SELECT SC.SCID AS skvN, CAST('#39#1053#1077#1090' '#1082#1086#1087#1080#1080' '#1076#1086#1087'. '#1089#1086#1075#1083#1072#1096#1077#1085#1080#1103#39' AS VARC' +
        'HAR(255)) AS mes'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'INNER JOIN SPEC_COND SC ON SC.AGID = A.AGID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID '
      'WHERE APU.PID = :PID_POLUCH'
      '    AND A.AGISDELETE IS NULL'
      '    AND SC.SCISDELETE IS NULL'
      
        '    AND ((CURRENT_DATE BETWEEN SC.SCDATEBEGIN AND COALESCE(sc.SC' +
        'DATERASTORJ, SC.SCDATEEND))'
      
        '            or (CURRENT_DATE < COALESCE(sc.SCDATERASTORJ, SC.SCD' +
        'ATEEND)))'
      '    AND NOT EXISTS'
      '    ('
      '     SELECT SCS.SCSID'
      '     FROM SC_SCAN SCS'
      '     WHERE SCS.SCID = SC.SCID'
      '    )'
      'UNION'
      
        'SELECT NULL AS skvN, CAST('#39#1053#1077#1090' '#1089#1087#1080#1089#1082#1072' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094#39' AS VARCHAR' +
        '(255)) AS mes'
      'FROM PEOPLE P'
      'WHERE P.PID = :pid_poluch'
      'AND NOT EXISTS'
      '('
      'SELECT DL.PID_POLUCH'
      'FROM DOV_LITSA DL'
      'WHERE DL.PID_POLUCH = P.PID'
      ')'
      'UNION'
      
        'SELECT NULL AS skvN, CAST('#39#1053#1077#1090' '#1082#1086#1087#1080#1080' '#1089#1087#1080#1089#1082#1072' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094#39' AS V' +
        'ARCHAR(255)) AS mes'
      'FROM DOV_LITSA DL'
      'WHERE DL.PID_POLUCH = :pid_poluch'
      'AND NOT EXISTS'
      '('
      'SELECT DDL.PID_POLUCH'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = DL.PID_POLUCH'
      ')'
      'UNION'
      
        'SELECT NULL AS skvN, CAST('#39#1050#1086#1087#1080#1080' '#1089#1087#1080#1089#1082#1072' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094' '#1073#1086#1083#1100#1096#1077' 6 ' +
        #1084#1077#1089#1103#1094#1077#1074'. '#1053#1077#1086#1073#1093#1086#1076#1080#1084#1086' '#1072#1082#1090#1091#1072#1083#1080#1079#1080#1088#1086#1074#1072#1090#1100' '#1080' '#1087#1077#1088#1077#1087#1086#1076#1087#1080#1089#1072#1090#1100' '#1089#1087#1080#1089#1086#1082#39' AS V' +
        'ARCHAR(255)) AS mes'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = :pid_poluch'
      
        '        AND DATEDIFF(MONTH FROM COALESCE(DDL.DDLTIMEEDIT, DDL.DD' +
        'LTIMEENTER) TO CURRENT_TIMESTAMP) > 6'
      'UNION'
      
        'SELECT DISTINCT NULL AS skvN,  CAST('#39#1042' '#1089#1087#1080#1089#1082#1077' '#1076#1086#1074#1077#1088#1077#1085#1085#1099#1093' '#1083#1080#1094' '#1086#1090#1089 +
        #1091#1090#1089#1090#1074#1091#1077#1090' '#1084#1086#1073'. '#1090#1077#1083#1077#1092#1086#1085#39' AS VARCHAR(255)) AS mes'
      'FROM DOV_LITSA DL'
      'WHERE DL.PID_POLUCH = :pid_poluch'
      'AND NOT EXISTS'
      '('
      'SELECT CI.PID'
      'FROM CONTACTINFO CI'
      'WHERE CI.PID = DL.PID AND CI.CITYPE = 1155'
      ')'
      'UNION'
      
        'SELECT DISTINCT NULL AS skvN, CAST('#39#1053#1077#1090' '#1087#1086#1089#1090#1086#1103#1085#1085#1086#1075#1086' '#1072#1076#1088#1077#1089#1072' '#1088#1077#1073#1077#1085 +
        #1082#1072#39' AS VARCHAR(255)) AS mes'
      'FROM PEOPLE P'
      'WHERE P.PID = :pid_poluch'
      ' AND NOT EXISTS('
      'SELECT CI.CIID'
      'FROM CONTACTINFO CI'
      'WHERE CI.PID = P.PID'
      '    AND CI.CITYPE = 1153'
      '    AND CHARACTER_LENGTH(CI.CIVALUE) > 10'
      'UNION'
      'SELECT CI.CIID'
      'FROM CONTACTINFO CI'
      'WHERE CI.PID = P.PID'
      '    AND CI.CITYPE = 1153'
      '    AND CI.KSID IS NOT NULL'
      '    AND CI.KID IS NOT NULL'
      ')')
    Left = 611
    Top = 652
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID_POLUCH'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID_POLUCH'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'PID_POLUCH'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid_poluch'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid_poluch'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid_poluch'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid_poluch'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid_poluch'
        ParamType = ptUnknown
      end>
    object qMessageSKVN: TIntegerField
      FieldName = 'SKVN'
      Origin = '"AGREEMENTS"."AGID"'
    end
    object qMessageMES: TIBStringField
      FieldName = 'MES'
      ProviderFlags = []
      Size = 255
    end
  end
  object cxPropertiesStore1: TcxPropertiesStore
    Components = <
      item
        Component = cbSC
        Properties.Strings = (
          'Value')
      end
      item
        Component = dbgPaymants_Agr
        Properties.Strings = (
          'Height'
          'Width')
      end
      item
        Component = cxSplitter5
        Properties.Strings = (
          'Left')
      end
      item
        Component = dbgAgr
        Properties.Strings = (
          'Height'
          'Width')
      end
      item
        Component = dbgSC
        Properties.Strings = (
          'Height'
          'Left'
          'Width')
      end
      item
        Component = Panel_dbgPeopleFind
        Properties.Strings = (
          'Height')
      end
      item
        Component = Panel12
        Properties.Strings = (
          'Height'
          'Width')
      end
      item
        Component = Panel13
        Properties.Strings = (
          'Height'
          'Width')
      end
      item
        Component = Panel17
        Properties.Strings = (
          'Height'
          'Left'
          'Top'
          'Width')
      end
      item
        Component = Panel8
        Properties.Strings = (
          'Height'
          'Width')
      end
      item
        Component = pcAgr
        Properties.Strings = (
          'ActivePage'
          'Height'
          'Left'
          'Top'
          'Width')
      end>
    StorageName = #1048#1057' '#1054#1083#1080#1084#1087#1080#1082'_PS_fmDetiView'
    StorageType = stRegistry
    Left = 832
    Top = 216
  end
  object sqlisdolg: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE OR INSERT INTO P_MISC_PROP (PID, PMPISDOLG)'
      'VALUES (:pid, :PMPISDOLG)'
      'MATCHING (PID)')
    Transaction = DMInv.IBTransaction1
    Left = 419
    Top = 460
  end
  object frAgr: TfrxReport
    Version = '4.9.32'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 40743.807145370400000000
    ReportOptions.LastChange = 41451.725972673600000000
    ScriptLanguage = 'PascalScript'
    StoreInDFM = False
    Left = 395
    Top = 504
  end
  object frxRichObject1: TfrxRichObject
    Left = 435
    Top = 508
  end
  object frxDBDataset1: TfrxDBDataset
    UserName = 'frxDBDataset_qBills'
    CloseDataSource = False
    DataSet = qBills
    BCDToCurrency = False
    Left = 475
    Top = 508
  end
  object frxDBDataset2: TfrxDBDataset
    UserName = 'frxDBDataset_qAgr'
    CloseDataSource = False
    DataSet = qAgr
    BCDToCurrency = False
    Left = 315
    Top = 588
  end
  object frxDBDataset3: TfrxDBDataset
    UserName = 'frxDBDataset_qForPrintAgr'
    CloseDataSource = False
    DataSet = qForPrintAgr
    BCDToCurrency = False
    Left = 539
    Top = 508
  end
  object frxPDFExport1: TfrxPDFExport
    UseFileCache = True
    ShowProgress = True
    OverwritePrompt = False
    PrintOptimized = False
    Outline = False
    Background = False
    HTMLTags = True
    Author = 'FastReport'
    Subject = 'FastReport PDF export'
    ProtectionFlags = [ePrint, eModify, eCopy, eAnnot]
    HideToolbar = False
    HideMenubar = False
    HideWindowUI = False
    FitWindow = False
    CenterWindow = False
    PrintScaling = False
    Left = 575
    Top = 508
  end
  object frxRTFExport1: TfrxRTFExport
    UseFileCache = True
    ShowProgress = True
    OverwritePrompt = False
    ExportEMF = True
    Wysiwyg = True
    Creator = 'FastReport'
    SuppressPageHeadersFooters = False
    HeaderFooterMode = hfText
    AutoSize = False
    Left = 611
    Top = 508
  end
  object frxDBDataset4: TfrxDBDataset
    UserName = 'frxDBDataset_qSpecCond'
    CloseDataSource = False
    DataSet = qSpecCond
    BCDToCurrency = False
    Left = 451
    Top = 724
  end
  object frxDBDataset5: TfrxDBDataset
    UserName = 'frxDBDataset_qPayData'
    CloseDataSource = False
    DataSet = qPayData
    BCDToCurrency = False
    Left = 491
    Top = 724
  end
  object frSpecCond: TfrxReport
    Version = '4.9.32'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 40743.807145370400000000
    ReportOptions.LastChange = 41432.467326053240000000
    ScriptLanguage = 'PascalScript'
    StoreInDFM = False
    Left = 451
    Top = 684
  end
  object qFood_Tariff: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      '     SELECT cast(FT.FTVALUE as integer) as FTVALUE'
      '     FROM FOOD_TARIFF FT'
      '     WHERE :SCDATE BETWEEN FT.FTDATEBEGIN AND FT.FTDATEEND')
    Left = 379
    Top = 676
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'SCDATE'
        ParamType = ptUnknown
      end>
    object qFood_TariffFTVALUE: TIntegerField
      FieldName = 'FTVALUE'
      ProviderFlags = []
    end
  end
  object qSrokDL: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT (CAST(COALESCE(DDL.DDLTIMEEDIT, DDL.DDLTIMEENTER) AS DATE' +
        ') + 183) AS srok'
      'FROM DOC_DOV_LITSA DDL'
      'WHERE DDL.PID_POLUCH = :PID_poluch')
    Left = 187
    Top = 495
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID_poluch'
        ParamType = ptUnknown
      end>
    object qSrokDLSROK: TDateField
      FieldName = 'SROK'
      ProviderFlags = []
    end
  end
  object qRR: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    CachedUpdates = True
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT *'
      'FROM'
      '('
      
        'SELECT RR.RRID, RR.RID, RR.RRTIMEEDIT, RR.RRTIMEENTER, RR.RRNOTE' +
        ', RR.RRTYPE, SD.SDNAME as type_request, IIF(RR.RID IS NULL, 0, 1' +
        ') AS is_formaliz,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor,'
      
        'p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS redaktor,'
      
        'p4.plastname || '#39' '#39' || SUBSTRING(p4.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p4.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_poluch,'
      
        'p5.plastname || '#39' '#39' || SUBSTRING(p5.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p5.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_dl,'
      
        'RR.RRMANAGERNOTE, rr.RRMANAGER, rr.RRDIREKTORNOTE, rr.RRDIREKTOR' +
        'OK, rr.RRCLIENTANSWER, 1 AS subtype'
      'FROM REGISTR_REQUEST RR'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = RR.RRTYPE'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = RR.RRUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = RR.RRUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U2.PID'
      'LEFT OUTER JOIN PEOPLE P4 ON P4.PID = RR.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P5 ON P5.PID = RR.PID'
      'where rr.rrisdelete is null'
      'AND RR.PID_POLUCH = :pid'
      'UNION'
      
        'SELECT RD.RDID, RD.RID, RD.RDTIMEEDIT, RD.RDTIMEENTER, RD.RDNOTE' +
        ', -1 AS RRTYPE, '#39#1054#1082#1072#1079#1072#1085#1080#1077' '#1091#1089#1083#1091#1075'('#1073#1077#1079' '#1087#1077#1088#1074'. '#1079#1072#1103#1074#1083')'#39' as type_reques' +
        't, 1 AS is_formaliz,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor,'
      
        'p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS redaktor,'
      
        'p4.plastname || '#39' '#39' || SUBSTRING(p4.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p4.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_poluch,'
      
        'p5.plastname || '#39' '#39' || SUBSTRING(p5.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p5.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_dl,'
      'null, null, null, null, null, 0 AS subtype'
      'FROM REQUEST_DEF RD'
      'INNER JOIN REQUEST R ON R.RID = RD.RID'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = RD.RDUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = RD.RDUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U2.PID'
      'LEFT OUTER JOIN PEOPLE P4 ON P4.PID = R.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P5 ON P5.PID = R.PID'
      'LEFT OUTER JOIN REQUEST_OTKAZ RO ON RO.RID = RD.RID'
      'WHERE R.PID_POLUCH = :pid AND R.RISDELETE IS NULL'
      'AND NOT EXISTS'
      '('
      'SELECT RR.RID'
      'FROM REGISTR_REQUEST RR'
      'WHERE RR.RID = R.RID'
      ')'
      ') AS sel'
      '')
    UpdateObject = quRR
    GeneratorField.Field = 'RRID'
    Left = 920
    Top = 728
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qRRRRID: TIntegerField
      FieldName = 'RRID'
      Origin = '"REGISTR_REQUEST"."RRID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qRRRID: TIntegerField
      FieldName = 'RID'
      Origin = '"REGISTR_REQUEST"."RID"'
    end
    object qRRRRTIMEENTER: TDateTimeField
      FieldName = 'RRTIMEENTER'
      Origin = '"REGISTR_REQUEST"."RRTIMEENTER"'
    end
    object qRRRRTIMEEDIT: TDateTimeField
      FieldName = 'RRTIMEEDIT'
      Origin = '"REGISTR_REQUEST"."RRTIMEEDIT"'
    end
    object qRRRRNOTE: TIBStringField
      FieldName = 'RRNOTE'
      Origin = '"REGISTR_REQUEST"."RRNOTE"'
      Size = 255
    end
    object qRRAUTOR: TIBStringField
      FieldName = 'AUTOR'
      ProviderFlags = []
      Size = 769
    end
    object qRRREDAKTOR: TIBStringField
      FieldName = 'REDAKTOR'
      ProviderFlags = []
      Size = 769
    end
    object qRRFIO_POLUCH: TIBStringField
      FieldName = 'FIO_POLUCH'
      ProviderFlags = []
      Size = 769
    end
    object qRRFIO_DL: TIBStringField
      FieldName = 'FIO_DL'
      ProviderFlags = []
      Size = 769
    end
    object qRRTYPE_REQUEST: TIBStringField
      FieldName = 'TYPE_REQUEST'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qRRIS_FORMALIZ: TIntegerField
      FieldName = 'IS_FORMALIZ'
      ProviderFlags = []
    end
    object qRRRRTYPE: TIntegerField
      FieldName = 'RRTYPE'
      ProviderFlags = []
    end
    object qRRRRMANAGERNOTE: TIBStringField
      FieldName = 'RRMANAGERNOTE'
      Origin = '"REGISTR_REQUEST"."RRMANAGERNOTE"'
      Size = 2048
    end
    object qRRRRMANAGER: TIBStringField
      FieldName = 'RRMANAGER'
      Origin = '"REGISTR_REQUEST"."RRMANAGER"'
      Size = 40
    end
    object qRRRRDIREKTORNOTE: TIBStringField
      FieldName = 'RRDIREKTORNOTE'
      Origin = '"REGISTR_REQUEST"."RRDIREKTORNOTE"'
      Size = 2048
    end
    object qRRRRDIREKTOROK: TIntegerField
      FieldName = 'RRDIREKTOROK'
      Origin = '"REGISTR_REQUEST"."RRDIREKTOROK"'
    end
    object qRRRRCLIENTANSWER: TIBStringField
      FieldName = 'RRCLIENTANSWER'
      Origin = '"REGISTR_REQUEST"."RRCLIENTANSWER"'
      Size = 2048
    end
    object qRRSUBTYPE: TIntegerField
      FieldName = 'SUBTYPE'
      ProviderFlags = []
    end
  end
  object dsRR: TDataSource
    DataSet = qRR
    OnDataChange = dsRRDataChange
    Left = 883
    Top = 727
  end
  object qRequestScan: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    Left = 955
    Top = 727
  end
  object qRRtemp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT *'
      'FROM'
      '('
      
        'SELECT RR.RRID, RR.RID, RR.RRTIMEEDIT, RR.RRTIMEENTER, RR.RRNOTE' +
        ', RR.RRTYPE, SD.SDNAME as type_request, IIF(RR.RID IS NULL, 0, 1' +
        ') AS is_formaliz,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor,'
      
        'p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS redaktor,'
      
        'p4.plastname || '#39' '#39' || SUBSTRING(p4.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p4.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_poluch,'
      
        'p5.plastname || '#39' '#39' || SUBSTRING(p5.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p5.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_dl,'
      
        'RR.RRMANAGERNOTE, rr.RRMANAGER, rr.RRDIREKTORNOTE, rr.RRDIREKTOR' +
        'OK, rr.RRCLIENTANSWER, 1 AS subtype'
      'FROM REGISTR_REQUEST RR'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = RR.RRTYPE'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = RR.RRUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = RR.RRUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U2.PID'
      'LEFT OUTER JOIN PEOPLE P4 ON P4.PID = RR.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P5 ON P5.PID = RR.PID'
      'where rr.rrisdelete is null'
      'AND RR.PID_POLUCH = :pid'
      'UNION'
      
        'SELECT RD.RDID, RD.RID, RD.RDTIMEEDIT, RD.RDTIMEENTER, RD.RDNOTE' +
        ', -1 AS RRTYPE, '#39#1054#1082#1072#1079#1072#1085#1080#1077' '#1091#1089#1083#1091#1075'('#1073#1077#1079' '#1087#1077#1088#1074'. '#1079#1072#1103#1074#1083')'#39' as type_reques' +
        't, 1 AS is_formaliz,'
      
        'p1.plastname || '#39' '#39' || SUBSTRING(p1.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p1.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS autor,'
      
        'p2.plastname || '#39' '#39' || SUBSTRING(p2.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p2.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS redaktor,'
      
        'p4.plastname || '#39' '#39' || SUBSTRING(p4.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p4.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_poluch,'
      
        'p5.plastname || '#39' '#39' || SUBSTRING(p5.pname FROM 1 FOR 1) || '#39'. '#39' ' +
        '|| COALESCE(SUBSTRING(p5.ppatronymic FROM 1 FOR 1) || '#39'.'#39', '#39' '#39') ' +
        'AS fio_dl,'
      'null, null, null, null, null, 0 AS subtype'
      'FROM REQUEST_DEF RD'
      'INNER JOIN REQUEST R ON R.RID = RD.RID'
      'LEFT OUTER JOIN USERS U1 ON U1.USNAME = RD.RDUSERENTER'
      'LEFT OUTER JOIN PEOPLE P1 ON P1.PID = U1.PID'
      'LEFT OUTER JOIN USERS U2 ON U2.USNAME = RD.RDUSEREDIT'
      'LEFT OUTER JOIN PEOPLE P2 ON P2.PID = U2.PID'
      'LEFT OUTER JOIN PEOPLE P4 ON P4.PID = R.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P5 ON P5.PID = R.PID'
      'LEFT OUTER JOIN REQUEST_OTKAZ RO ON RO.RID = RD.RID'
      'WHERE R.PID_POLUCH = :pid AND R.RISDELETE IS NULL'
      'AND NOT EXISTS'
      '('
      'SELECT RR.RID'
      'FROM REGISTR_REQUEST RR'
      'WHERE RR.RID = R.RID'
      ')'
      ') AS sel'
      '')
    GeneratorField.Field = 'RRID'
    Left = 920
    Top = 760
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
  end
  object qRegistr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT IIF(R.PUTARGET = 0,'#39#1055#1088#1080#1085#1103#1083#39', '#39#1042#1099#1076#1072#1083#39') as tip, R.PUTIME,'
      
        '(COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39' '#39'||COA' +
        'LESCE(P.PPATRONYMIC,'#39' '#39')) AS fio'
      'FROM PU_REGISTER R'
      'INNER JOIN PEOPLE P ON P.PID = R.PID'
      'WHERE R.POLUCH_USL = :PID'
      'order by 2')
    Left = 795
    Top = 695
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
    object qRegistrPUTIME: TDateTimeField
      FieldName = 'PUTIME'
      Origin = '"PU_REGISTER"."PUTIME"'
    end
    object qRegistrFIO: TIBStringField
      FieldName = 'FIO'
      ProviderFlags = []
      Size = 767
    end
    object qRegistrTIP: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 6
    end
  end
  object dsRegistr: TDataSource
    DataSet = qRegistr
    Left = 835
    Top = 695
  end
  object sqlResetGPChange: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE SPEC_COND SC1 SET SC1.SCISGRAFEDIT = null'
      'WHERE SC1.SCISGRAFEDIT = 1'
      'AND SC1.SCID ='
      '('
      'SELECT DISTINCT SC.SCID'
      'FROM SPEC_COND SC '
      'INNER JOIN AGR_POLUCH_USLUG APU1 ON APU1.AGID = SC.AGID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID '
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN'
      '('
      'SELECT t1.sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID, o)'
      
        '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID, CAST('#39#39' AS VARCHAR' +
        '(2048)) AS o FROM SYS_DIC SD'
      '      WHERE sd.SDPARID = 1880'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID, '#39#39' || o'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  o || SDNAME AS SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      ''
      ') AS sd_osn ON sd_osn.sdid = ST.SDID'
      
        'where CURRENT_DATE BETWEEN SC.SCDATEBEGIN AND COALESCE(sc.SCDATE' +
        'RASTORJ, SC.SCDATEEND)'
      'AND APU1.PID  = :pid'
      'AND SC.SCISDELETE IS NULL)')
    Transaction = DMInv.IBTransaction1
    Left = 979
    Top = 139
  end
  object qRel_people_rodstv: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    AfterClose = qRelPeopleAfterClose
    AfterOpen = qRelPeopleAfterOpen
    SQL.Strings = (
      
        'SELECT (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39 +
        ' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS fio, Sd.SDNAME, P.PDATEBIRTH' +
        ', ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, PD.DSERIA' +
        ', PD.DNUMBER,'
      '       ci3.CIVALUE AS email, PD.DDATE, DL.*'
      'FROM DOV_LITSA DL'
      
        'left outer JOIN DOC_DOV_LITSA  DDL ON DL.PID_POLUCH = DDL.PID_PO' +
        'LUCH'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDELET' +
        'E IS NULL'
      'WHERE DL.PID_POLUCH = :PID'
      '--UNION'
      
        '--SELECT (COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')|' +
        '|'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS fio, Sd.SDNAME, P.PDATEBIR' +
        'TH, ci.CIVALUE AS tel_dom,'
      
        '--       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, PD.DSER' +
        'IA, PD.DNUMBER,'
      '--       ci3.CIVALUE AS email, PD.DDATE, DL.*'
      '--FROM dov_litsa dl'
      '--left outer JOIN PEOPLE P ON P.PID = DL.PID'
      '--left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        '--LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYP' +
        'E = 1154'
      
        '--LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CI' +
        'TYPE = 1155'
      
        '--LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CI' +
        'TYPE = 1156'
      
        '--LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CI' +
        'TYPE = 1255'
      
        '--LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE' +
        ' IN (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDEL' +
        'ETE IS NULL'
      '--WHERE dl.PID_POLUCH in'
      '--(SELECT r.pid'
      '--FROM rodstvennik r'
      '--WHERE r.rid in (SELECT DISTINCT r1.rid'
      '--               FROM rodstvennik r1'
      '--               WHERE r1.pid = :pid))'
      '--order by 1')
    GeneratorField.Field = 'PRID'
    Left = 1120
    Top = 760
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object IBStringField57: TIBStringField
      FieldName = 'FIO'
      ProviderFlags = []
      Size = 769
    end
    object IBStringField58: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object DateField19: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object IntegerField5: TIntegerField
      FieldName = 'PID'
      Origin = '"PEOPLE"."PID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object IBStringField59: TIBStringField
      FieldName = 'TEL_DOM'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object IBStringField60: TIBStringField
      FieldName = 'TEL_MOB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object IBStringField61: TIBStringField
      FieldName = 'TEL_RAB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object IBStringField62: TIBStringField
      FieldName = 'DSERIA'
      Origin = '"P_DOCUMENTS"."DSERIA"'
      Size = 10
    end
    object IBStringField63: TIBStringField
      FieldName = 'DNUMBER'
      Origin = '"P_DOCUMENTS"."DNUMBER"'
    end
    object IBStringField64: TIBStringField
      FieldName = 'EMAIL'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object DateField20: TDateField
      FieldName = 'DDATE'
      Origin = '"P_DOCUMENTS"."DDATE"'
    end
    object IntegerField44: TIntegerField
      FieldName = 'PID_POLUCH'
      Origin = '"DOV_LITSA"."PID_POLUCH"'
      Required = True
    end
    object IntegerField45: TIntegerField
      FieldName = 'DLSTATUS'
      Origin = '"DOV_LITSA"."DLSTATUS"'
    end
    object IBStringField65: TIBStringField
      FieldName = 'DLNOTE'
      Origin = '"DOV_LITSA"."DLNOTE"'
      Size = 255
    end
    object IBStringField66: TIBStringField
      FieldName = 'DLUSERENTER'
      Origin = '"DOV_LITSA"."DLUSERENTER"'
      Size = 40
    end
    object DateTimeField14: TDateTimeField
      FieldName = 'DLTIMEENTER'
      Origin = '"DOV_LITSA"."DLTIMEENTER"'
    end
    object IBStringField67: TIBStringField
      FieldName = 'DLUSEREDIT'
      Origin = '"DOV_LITSA"."DLUSEREDIT"'
      Size = 40
    end
    object DateTimeField15: TDateTimeField
      FieldName = 'DLTIMEEDIT'
      Origin = '"DOV_LITSA"."DLTIMEEDIT"'
    end
  end
  object qPrintDovLitsa_rodstv: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, Sd.SDNAME, P.PDATEBI' +
        'RTH, ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, (PD.DSERI' +
        'A||'#39'   '#39'||PD.DNUMBER) AS passport,'
      '       ci3.CIVALUE AS email, PD.DDATE'
      'FROM DOV_LITSA DL'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDELET' +
        'E IS NULL'
      'INNER JOIN'
      '(SELECT r.pid'
      'FROM rodstvennik r'
      'WHERE r.rid in (SELECT DISTINCT r1.rid'
      '               FROM rodstvennik r1'
      
        '               WHERE r1.pid = :pid)) AS rod on rod.pid = dl.PID_' +
        'POLUCH'
      'UNION'
      
        'SELECT P.PLASTNAME, P.PNAME, P.PPATRONYMIC, Sd.SDNAME, P.PDATEBI' +
        'RTH, ci.CIVALUE AS tel_dom,'
      
        '       ci1.CIVALUE AS tel_mob, ci2.CIVALUE AS tel_rab, (PD.DSERI' +
        'A||'#39'   '#39'||PD.DNUMBER) AS passport,'
      '       ci3.CIVALUE AS email, PD.DDATE'
      'FROM DOV_LITSA DL'
      'left outer JOIN PEOPLE P ON P.PID = DL.PID'
      'left outer JOIN SYS_DIC Sd ON sd.SDID = DL.DLSTATUS'
      
        'LEFT OUTER JOIN CONTACTINFO CI ON CI.PID = DL.PID AND CI.CITYPE ' +
        '= 1154'
      
        'LEFT OUTER JOIN CONTACTINFO CI1 ON CI1.PID = DL.PID AND CI1.CITY' +
        'PE = 1155'
      
        'LEFT OUTER JOIN CONTACTINFO CI2 ON CI2.PID = DL.PID AND CI2.CITY' +
        'PE = 1156'
      
        'LEFT OUTER JOIN CONTACTINFO CI3 ON CI3.PID = DL.PID AND CI3.CITY' +
        'PE = 1255'
      
        'LEFT OUTER JOIN P_DOCUMENTS PD ON PD.PID = DL.PID AND PD.DTYPE I' +
        'N (1050, 1464, 1465) AND PD.DMAINDOC IS NOT NULL AND PD.DISDELET' +
        'E IS NULL'
      'WHERE DL.PID_POLUCH = :pid'
      'UNION ALL'
      
        'SELECT FIRST 6 NULL AS PLASTNAME, NULL AS PNAME, NULL AS PPATRON' +
        'YMIC, NULL AS SDNAME, NULL AS PDATEBIRTH, NULL AS tel_dom,'
      
        '       NULL AS tel_mob, NULL AS tel_rab, NULL AS passport, NULL ' +
        'AS email, NULL AS DDATE'
      'FROM DOV_LITSA'
      'order by 1 desc')
    Left = 106
    Top = 507
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end
      item
        DataType = ftInteger
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object IBStringField68: TIBStringField
      FieldName = 'PLASTNAME'
      Origin = '"PEOPLE"."PLASTNAME"'
      Size = 255
    end
    object IBStringField69: TIBStringField
      FieldName = 'PNAME'
      Origin = '"PEOPLE"."PNAME"'
      Size = 255
    end
    object IBStringField70: TIBStringField
      FieldName = 'PPATRONYMIC'
      Origin = '"PEOPLE"."PPATRONYMIC"'
      Size = 255
    end
    object IBStringField71: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object DateField21: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object IBStringField72: TIBStringField
      FieldName = 'TEL_DOM'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object IBStringField73: TIBStringField
      FieldName = 'TEL_MOB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object IBStringField74: TIBStringField
      FieldName = 'TEL_RAB'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object IBStringField75: TIBStringField
      FieldName = 'PASSPORT'
      ProviderFlags = []
      Size = 42
    end
    object IBStringField76: TIBStringField
      FieldName = 'EMAIL'
      Origin = '"CONTACTINFO"."CIVALUE"'
      Size = 255
    end
    object DateField22: TDateField
      FieldName = 'DDATE'
      Origin = '"P_DOCUMENTS"."DDATE"'
    end
  end
  object frPrintDolg: TfrxDBDataset
    UserName = 'PrintDolg'
    CloseDataSource = False
    DataSet = qPrintDolg
    BCDToCurrency = False
    Left = 117
    Top = 705
  end
  object frReport: TfrxReport
    Version = '4.9.32'
    DotMatrixReport = False
    IniFile = '\Software\Fast Reports'
    PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick]
    PreviewOptions.Zoom = 1.000000000000000000
    PrintOptions.Printer = 'Default'
    PrintOptions.PrintOnSheet = 0
    ReportOptions.CreateDate = 40743.807145370400000000
    ReportOptions.LastChange = 41241.623653240700000000
    ScriptLanguage = 'PascalScript'
    StoreInDFM = False
    Left = 83
    Top = 708
  end
  object frPrintgrafik: TfrxDBDataset
    UserName = 'Printgrafik'
    CloseDataSource = False
    DataSet = qPrintGrafik
    BCDToCurrency = False
    Left = 117
    Top = 745
  end
  object frCommon: TfrxDBDataset
    UserName = 'Common'
    CloseDataSource = False
    DataSet = qCommon
    BCDToCurrency = False
    Left = 1165
    Top = 681
  end
  object frComRaznes: TfrxDBDataset
    UserName = 'ComRaznes'
    CloseDataSource = False
    DataSet = qComRaznes
    BCDToCurrency = False
    Left = 1165
    Top = 713
  end
  object qAgr_DL: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT FIRST 1 AG.AGID, AG.AGNUM, AG.AGNUM_N, AG.AGDATEBEGIN, CO' +
        'ALESCE(sc.SCDATERASTORJ, SC.SCDATEEND) AS sc_dateend,'
      
        '(P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||COALESCE(P.PPATRONYMIC,'#39' '#39')) AS' +
        ' fio_poluch_usl,'
      'sd1.SDNAME AS podr,'
      
        'CAST( LIST(DISTINCT (P1.PLASTNAME||'#39' '#39'||P1.PNAME||'#39' '#39'||COALESCE(' +
        'P1.PPATRONYMIC,'#39' '#39')), '#39', '#39') AS VARCHAR(2048)) AS podp'
      'FROM SPEC_COND SC'
      'INNER JOIN AGREEMENTS AG ON AG.AGID = SC.AGID'
      'INNER JOIN AGR_PODPISANT AP ON AP.AGID = AG.AGID'
      'INNER JOIN PEOPLE P1 ON P1.PID = AP.PID'
      'INNER JOIN AGR_POLUCH_USLUG APU1 ON APU1.AGID = SC.AGID'
      'INNER JOIN PEOPLE P ON P.PID = APU1.PID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID '
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN'
      '('
      'SELECT t2.sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID in (11746,1880)'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t2'
      ') AS sd_osn ON sd_osn.sdid = ST.SDID'
      
        'LEFT OUTER JOIN deti_podrazd dp ON dp.pid = apu1.PID AND CURRENT' +
        '_DATE BETWEEN CAST(dp.dpdatein AS DATE) AND COALESCE(CAST(dp.dpd' +
        'ateout AS DATE), CURRENT_DATE)'
      'LEFT OUTER JOIN SYS_DIC SD1 ON SD1.SDID = dp.SDID'
      'where CURRENT_DATE < COALESCE(sc.SCDATERASTORJ, SC.SCDATEEND)'
      'AND APU1.PID = :PID'
      'GROUP BY 1,2,3,4,5,6,7'
      'ORDER by 5')
    Left = 171
    Top = 536
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qAgr_DLAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"AGREEMENTS"."AGID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qAgr_DLAGNUM: TIBStringField
      FieldName = 'AGNUM'
      Origin = '"AGREEMENTS"."AGNUM"'
      Size = 40
    end
    object qAgr_DLAGNUM_N: TIntegerField
      FieldName = 'AGNUM_N'
      Origin = '"AGREEMENTS"."AGNUM_N"'
    end
    object qAgr_DLAGDATEBEGIN: TDateField
      FieldName = 'AGDATEBEGIN'
      Origin = '"AGREEMENTS"."AGDATEBEGIN"'
    end
    object qAgr_DLFIO_POLUCH_USL: TIBStringField
      FieldName = 'FIO_POLUCH_USL'
      ProviderFlags = []
      Size = 767
    end
    object qAgr_DLPODP: TIBStringField
      FieldName = 'PODP'
      ProviderFlags = []
      Size = 2048
    end
    object qAgr_DLPODR: TIBStringField
      FieldName = 'PODR'
      ProviderFlags = []
      Size = 255
    end
  end
  object frAgr_DL: TfrxDBDataset
    UserName = 'Agr_DL'
    CloseDataSource = False
    DataSet = qAgr_DL
    BCDToCurrency = False
    Left = 203
    Top = 540
  end
  object frPrintDovLitsa: TfrxDBDataset
    UserName = 'PrintDovLitsa'
    CloseDataSource = False
    FieldAliases.Strings = (
      'PLASTNAME=PLASTNAME'
      'PNAME=PNAME'
      'PPATRONYMIC=PPATRONYMIC'
      'SDNAME=SDNAME'
      'PDATEBIRTH=PDATEBIRTH'
      'TEL_DOM=TEL_DOM'
      'TEL_MOB=TEL_MOB'
      'TEL_RAB=TEL_RAB'
      'PASSPORT=PASSPORT'
      'EMAIL=EMAIL'
      'PASSP_DATE=PASSP_DATE')
    DataSet = qPrintDovLitsa
    BCDToCurrency = False
    Left = 163
    Top = 492
  end
  object sqlRetSummer: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'execute procedure ADDBALANCE_RETURNSUMMER(:pid_poluch, :amount);')
    Transaction = DMInv.IBTransaction1
    Left = 875
    Top = 531
  end
  object sqlSpecCondUndelete: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE SPEC_COND SC SET SC.SCISDELETE = NULL'
      'WHERE SC.SCID = :SCID AND SC.SCISDELETE IS NOT NULL')
    Transaction = DMInv.IBTransaction1
    Left = 267
    Top = 500
  end
  object dsSD_ReqType: TDataSource
    DataSet = qSD_ReqType
    Left = 523
    Top = 423
  end
  object qSD_ReqType: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t1.*'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID  = 26'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      'where t1.sdid <> 11914 and t1.sdid <> 11916'
      'UNION'
      'SELECT FIRST 1 '#39#1042#1089#1077#39' AS SDNAME, -100 AS SDID, -100 AS SDPARID'
      'FROM SYS_DIC SD'
      'order by 1'
      '')
    GeneratorField.Field = 'SDID'
    Left = 560
    Top = 424
    object qSD_ReqTypeSDNAME: TIBStringField
      FieldName = 'SDNAME'
      ProviderFlags = []
      Size = 2304
    end
    object qSD_ReqTypeSDID: TIntegerField
      FieldName = 'SDID'
      ProviderFlags = []
    end
    object qSD_ReqTypeSDPARID: TIntegerField
      FieldName = 'SDPARID'
      ProviderFlags = []
    end
  end
  object sqlUpdateReqOtkazIsdone: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE REQUEST_OTKAZ RO SET RO.RDONE = :DONE'
      'WHERE RO.RID = :RID')
    Transaction = DMInv.IBTransaction1
    Left = 952
    Top = 758
  end
  object dxBarManager1: TdxBarManager
    AllowReset = False
    AlwaysSaveText = True
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -12
    Font.Name = 'Segoe UI'
    Font.Style = []
    Categories.Strings = (
      'Default'
      'ExtraSevice')
    Categories.ItemsVisibles = (
      2
      2)
    Categories.Visibles = (
      True
      True)
    ImageOptions.Images = DMInv.cxSmallImages
    LookAndFeel.SkinName = 'Office2007Silver'
    MenuAnimations = maFade
    NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
    PopupMenuLinks = <>
    ShowHint = False
    UseSystemFont = True
    Left = 1041
    Top = 284
    DockControlHeights = (
      0
      0
      0
      0)
    object dxBarManager1Bar1: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = 'Custom 1'
      CaptionButtons = <>
      DockControl = dxBarDockControl1
      DockedDockControl = dxBarDockControl1
      DockedLeft = 0
      DockedTop = 0
      FloatLeft = 124
      FloatTop = 133
      FloatClientWidth = 0
      FloatClientHeight = 0
      ItemLinks = <
        item
          Visible = True
          ItemName = 'dxBarButton1'
        end
        item
          Visible = True
          ItemName = 'dxBarButton2'
        end
        item
          Visible = True
          ItemName = 'bbDelete'
        end
        item
          Visible = True
          ItemName = 'dxBarButton3'
        end>
      OneOnRow = True
      Row = 0
      UseOwnFont = False
      UseRestSpace = True
      Visible = True
      WholeRow = False
    end
    object dxBarManager1Bar2: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = #1069#1082#1089#1090#1088#1072#1091#1089#1083#1091#1075#1072
      CaptionButtons = <>
      DockControl = bdcExtraService
      DockedDockControl = bdcExtraService
      DockedLeft = 0
      DockedTop = 0
      FloatLeft = 257
      FloatTop = 123
      FloatClientWidth = 0
      FloatClientHeight = 0
      ItemLinks = <
        item
          Visible = True
          ItemName = 'dxBarButton4'
        end
        item
          Visible = True
          ItemName = 'dxBarButton5'
        end>
      NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
      OneOnRow = True
      Row = 0
      UseOwnFont = False
      UseRestSpace = True
      Visible = True
      WholeRow = False
    end
    object dxBarManager1Bar3: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = #1041#1072#1083#1072#1085#1089
      CaptionButtons = <>
      DockControl = dxBarDockControl2
      DockedDockControl = dxBarDockControl2
      DockedLeft = 0
      DockedTop = 0
      FloatLeft = 395
      FloatTop = 110
      FloatClientWidth = 0
      FloatClientHeight = 0
      ItemLinks = <
        item
          Visible = True
          ItemName = 'cxBarEditItem2'
        end
        item
          UserDefine = [udWidth]
          UserWidth = 299
          Visible = True
          ItemName = 'beDateBalance'
        end
        item
          Visible = True
          ItemName = 'cxBarEditItem1'
        end
        item
          Visible = True
          ItemName = 'dxBarButton6'
        end>
      NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
      OneOnRow = True
      Row = 0
      UseOwnFont = False
      UseRestSpace = True
      Visible = True
      WholeRow = False
    end
    object dxBarButton1: TdxBarButton
      Caption = 'New Button'
      Category = 0
      Hint = 'New Button'
      Visible = ivAlways
      ImageIndex = 57
      OnClick = dxBarButton1Click
    end
    object dxBarButton2: TdxBarButton
      Caption = 'New Button'
      Category = 0
      Hint = 'New Button'
      Visible = ivAlways
      ImageIndex = 9
      OnClick = dxBarButton2Click
    end
    object dxBarButton3: TdxBarButton
      Align = iaRight
      Caption = 'New Button'
      Category = 0
      Hint = 'New Button'
      Visible = ivAlways
      ImageIndex = 17
      OnClick = dxBarButton3Click
    end
    object bbDelete: TdxBarButton
      Caption = 'New Button'
      Category = 0
      Enabled = False
      Hint = 'New Button'
      Visible = ivAlways
      ImageIndex = 10
      OnClick = bbDeleteClick
    end
    object beDateBalance: TcxBarEditItem
      Caption = 'New Item'
      Category = 0
      Hint = 'New Item'
      Visible = ivAlways
      OnChange = beDateBalanceChange
      Width = 100
      PropertiesClassName = 'TcxButtonEditProperties'
      Properties.Buttons = <
        item
          Default = True
          Kind = bkEllipsis
        end>
      Properties.OnButtonClick = beDateBalancePropertiesButtonClick
      InternalEditValue = ''
    end
    object cxBarEditItem2: TcxBarEditItem
      Caption = #1055#1077#1088#1080#1086#1076' '#1073#1072#1083#1072#1085#1089#1072': '
      Category = 0
      Hint = #1055#1077#1088#1080#1086#1076' '#1073#1072#1083#1072#1085#1089#1072': '
      Visible = ivAlways
      Width = 100
      PropertiesClassName = 'TcxLabelProperties'
    end
    object dxBarButton6: TdxBarButton
      Align = iaRight
      Caption = 'New Button'
      Category = 0
      Hint = 'New Button'
      Visible = ivAlways
      ImageIndex = 17
      OnClick = dxBarButton6Click
    end
    object cxBarEditItem1: TcxBarEditItem
      Caption = '*'#1045#1089#1083#1080' '#1087#1077#1088#1080#1086#1076' '#1085#1077' '#1091#1082#1072#1079#1072#1085', '#1090#1086' '#1073#1077#1088#1091#1090#1089#1103' '#1076#1072#1085#1085#1099#1077' '#1079#1072' '#1087#1086#1089#1083#1077#1076#1085#1080#1077' 30 '#1076#1085#1077#1081
      Category = 0
      Hint = '*'#1045#1089#1083#1080' '#1087#1077#1088#1080#1086#1076' '#1085#1077' '#1091#1082#1072#1079#1072#1085', '#1090#1086' '#1073#1077#1088#1091#1090#1089#1103' '#1076#1072#1085#1085#1099#1077' '#1079#1072' '#1087#1086#1089#1083#1077#1076#1085#1080#1077' 30 '#1076#1085#1077#1081
      Visible = ivAlways
      Width = 100
      PropertiesClassName = 'TcxLabelProperties'
    end
    object dxBarButton4: TdxBarButton
      Action = actExtraServiceAdd
      Category = 1
    end
    object dxBarButton5: TdxBarButton
      Action = actExtraServiceDelete
      Category = 1
    end
  end
  object qSCPodrazd: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dsSpecCond
    SQL.Strings = (
      'SELECT DP.*, SD.SDNAME'
      'FROM DETI_PODRAZD_SC DP'
      'INNER JOIN SYS_DIC SD ON SD.SDID = DP.SDID'
      'WHERE DP.SCID = :scid')
    Left = 1217
    Top = 508
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'scid'
        ParamType = ptUnknown
      end>
    object qSCPodrazdDPID: TIntegerField
      FieldName = 'DPID'
      Origin = '"DETI_PODRAZD_SC"."DPID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qSCPodrazdSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"DETI_PODRAZD_SC"."SCID"'
    end
    object qSCPodrazdSDID: TIntegerField
      FieldName = 'SDID'
      Origin = '"DETI_PODRAZD_SC"."SDID"'
    end
    object qSCPodrazdDPTYPE: TIntegerField
      FieldName = 'DPTYPE'
      Origin = '"DETI_PODRAZD_SC"."DPTYPE"'
    end
    object qSCPodrazdINNOTE: TIBStringField
      FieldName = 'INNOTE'
      Origin = '"DETI_PODRAZD_SC"."INNOTE"'
      Size = 255
    end
    object qSCPodrazdOUTNOTE: TIBStringField
      FieldName = 'OUTNOTE'
      Origin = '"DETI_PODRAZD_SC"."OUTNOTE"'
      Size = 255
    end
    object qSCPodrazdDPUSERENTER: TIBStringField
      FieldName = 'DPUSERENTER'
      Origin = '"DETI_PODRAZD_SC"."DPUSERENTER"'
      Size = 40
    end
    object qSCPodrazdDPTIMEENTER: TDateTimeField
      FieldName = 'DPTIMEENTER'
      Origin = '"DETI_PODRAZD_SC"."DPTIMEENTER"'
    end
    object qSCPodrazdDPUSEREDIT: TIBStringField
      FieldName = 'DPUSEREDIT'
      Origin = '"DETI_PODRAZD_SC"."DPUSEREDIT"'
      Size = 40
    end
    object qSCPodrazdDPTIMEEDIT: TDateTimeField
      FieldName = 'DPTIMEEDIT'
      Origin = '"DETI_PODRAZD_SC"."DPTIMEEDIT"'
    end
    object qSCPodrazdSDNAME: TIBStringField
      FieldName = 'SDNAME'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qSCPodrazdDPDATEIN: TDateField
      FieldName = 'DPDATEIN'
      Origin = '"DETI_PODRAZD_SC"."DPDATEIN"'
    end
    object qSCPodrazdDPDATEOUT: TDateField
      FieldName = 'DPDATEOUT'
      Origin = '"DETI_PODRAZD_SC"."DPDATEOUT"'
    end
  end
  object dsSCPodrazd: TDataSource
    DataSet = qSCPodrazd
    Left = 1185
    Top = 508
  end
  object sqlInsertPodrazdSC: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      
        'INSERT INTO DETI_PODRAZD_SC (DPID, SCID, SDID, DPTYPE, DPDATEIN,' +
        ' INNOTE, DPDATEOUT)'
      
        'VALUES(GEN_ID(GEN_DETI_PODRAZD_SC_ID,1), :scid, :SDID, :DPTYPE, ' +
        ':DPDATEIN, :INNOTE, :DPDATEOUT)')
    Transaction = DMInv.IBTransaction1
    Left = 1249
    Top = 508
  end
  object sqlPerevodPodrazdSC: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      
        'EXECUTE PROCEDURE SP_PEREVODPODRAZDSC(:ISSCEDIT, :date_begin, :d' +
        'ate_end, :SCID, :SDID, :DPTYPE, :DPNOTE)')
    Transaction = DMInv.IBTransaction1
    Left = 1249
    Top = 540
  end
  object sqlDelPodrSC: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'DELETE FROM DETI_PODRAZD_SC D WHERE d.DPID = :dpid')
    Transaction = DMInv.IBTransaction1
    Left = 1249
    Top = 572
  end
  object qPrintBallance: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      'SELECT 1 as id, UN.*,'
      '('
      'SELECT SUM(sel.summa) + CAST(:prev_dolg AS D_FLOAT)'
      'FROM'
      '('
      'SELECT G1.GPAMOUNT AS summa'
      'FROM SC_GRAFPLAT G1'
      'INNER JOIN SPEC_COND SC1 ON SC1.SCID = G1.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC1.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.STEDIZMER'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC1.AGID'
      'WHERE G1.GPDATE BETWEEN :date_begin AND UN.GPDATE'
      'AND SC1.SCISDELETE IS NULL  AND APU.PID = :pid'
      'UNION ALL'
      'SELECT (-1)*P1.PAAMOUNT AS summa'
      'FROM PAYMANTS_AGR P1'
      'WHERE P1.PAISDELETE IS NULL AND P1.PID_POLUCH = :pid'
      '    AND P1.PADATE BETWEEN :date_begin AND UN.GPDATE'
      ') AS sel) AS dolg'
      'FROM'
      '('
      
        'SELECT G.GPDATE, SC.SCID, ('#39#1058#1088#1077#1073#1091#1077#1084#1099#1081' '#1087#1083#1072#1090#1077#1078' '#1079#1072': '#39'|| ST.STNAME) ' +
        'AS STNAME, SD.SDNAME AS ed_izmer, COALESCE(S.SCOUNT,1) AS kol_ed' +
        ','
      'SC.SCTARIFWITHDISCOUNT,'
      
        '('#39#1089' '#39'|| G.GPBEGINPERIOD||'#39' '#1087#1086' '#39'||G.GPENDPERIOD) AS PERIOD, G.GPA' +
        'MOUNT,'
      'NULL AS oplata'
      'FROM SC_GRAFPLAT G'
      'INNER JOIN SPEC_COND SC ON SC.SCID = G.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.STEDIZMER'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'WHERE G.GPDATE BETWEEN :date_begin AND :date_end'
      'AND SC.SCISDELETE IS NULL  AND APU.PID = :pid'
      'UNION'
      
        'SELECT P.PADATE, NULL AS SCID, '#39#1055#1054#1057#1058#1059#1055#1051#1045#1053#1048#1045' '#1057#1056#1045#1044#1057#1058#1042#39' AS STNAME, ' +
        #39#1088#1091#1073'.'#39' AS ed_izmer, NULL AS kol_ed,'
      'NULL AS SCTARIFWITHDISCOUNT,'
      'NULL AS PERIOD, NULL AS GPAMOUNT,'
      'P.PAAMOUNT AS oplata'
      'FROM PAYMANTS_AGR P'
      'WHERE P.PAISDELETE IS NULL AND P.PID_POLUCH = :pid'
      '    AND P.PADATE BETWEEN :date_begin AND :date_end'
      'ORDER BY 1,2'
      ') AS UN')
    Left = 280
    Top = 296
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'prev_dolg'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_end'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_end'
        ParamType = ptUnknown
      end>
    object qPrintBallanceGPDATE: TDateField
      FieldName = 'GPDATE'
      Origin = '"SC_GRAFPLAT"."GPDATE"'
    end
    object qPrintBallanceSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qPrintBallanceSTNAME: TIBStringField
      FieldName = 'STNAME'
      Origin = '"SERVICES_TYPE"."STNAME"'
      Size = 255
    end
    object qPrintBallanceED_IZMER: TIBStringField
      FieldName = 'ED_IZMER'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPrintBallanceKOL_ED: TIntegerField
      FieldName = 'KOL_ED'
      ProviderFlags = []
    end
    object qPrintBallancePERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 26
    end
    object qPrintBallanceGPAMOUNT: TIBBCDField
      FieldName = 'GPAMOUNT'
      Origin = '"SC_GRAFPLAT"."GPAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintBallanceOPLATA: TIBBCDField
      FieldName = 'OPLATA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintBallanceDOLG: TIBBCDField
      FieldName = 'DOLG'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintBallanceSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintBallanceID: TIntegerField
      FieldName = 'ID'
      ProviderFlags = []
    end
  end
  object qPrintPrevBallance: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      'SELECT SUM(sel.summa) as prev_dolg'
      'FROM'
      '('
      'SELECT G1.GPAMOUNT AS summa'
      'FROM SC_GRAFPLAT G1'
      'INNER JOIN SPEC_COND SC ON SC.SCID = G1.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.STEDIZMER'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'WHERE G1.GPDATE< :date_begin'
      'AND SC.SCISDELETE IS NULL  AND APU.PID = :pid'
      'UNION all'
      'SELECT (-1)*P1.PAAMOUNTBALANCE AS summa'
      'FROM PAYMANTS_AGR P1'
      'WHERE P1.PAISDELETE IS NULL AND P1.PID_POLUCH = :pid'
      '    AND CAST(P1.PATIMEENTER AS DATE) < :date_begin'
      ') AS sel')
    Left = 320
    Top = 296
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end>
    object qPrintPrevBallancePREV_DOLG: TIBBCDField
      FieldName = 'PREV_DOLG'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
  end
  object qPrintNextPayments: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      
        'SELECT G.GPDATE, SC.SCID, ('#39#1058#1088#1077#1073#1091#1077#1084#1099#1081' '#1087#1083#1072#1090#1077#1078' '#1079#1072': '#39'|| ST.STNAME) ' +
        'AS STNAME, SD.SDNAME AS ed_izmer, COALESCE(S.SCOUNT,1) AS kol_ed' +
        ','
      'SC.SCTARIFWITHDISCOUNT,'
      
        '('#39#1089' '#39'|| G.GPBEGINPERIOD||'#39' '#1087#1086' '#39'||G.GPENDPERIOD) AS PERIOD, G.GPA' +
        'MOUNT,'
      'NULL AS oplata,'
      '('
      'SELECT SUM(sel.summa) + CAST(:prev_dolg AS D_FLOAT)'
      'FROM'
      '('
      'SELECT COALESCE(G1.GPAMOUNT,0) AS summa'
      'FROM SC_GRAFPLAT G1'
      'INNER JOIN SPEC_COND SC1 ON SC1.SCID = G1.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC1.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.STEDIZMER'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC1.AGID'
      'WHERE G1.GPDATE BETWEEN :date_begin AND G.GPDATE'
      'AND SC1.SCISDELETE IS NULL  AND APU.PID = :pid'
      'AND SC1.SCID <= SC.SCID'
      'UNION'
      'SELECT (-1)* COALESCE(P1.PAAMOUNT, 0) AS summa'
      'FROM PAYMANTS_AGR P1'
      'WHERE P1.PAISDELETE IS NULL AND P1.PID_POLUCH = :pid'
      '    AND P1.PADATE BETWEEN :date_begin AND G.GPDATE'
      ''
      ') AS sel) AS dolg'
      'FROM SC_GRAFPLAT G'
      'INNER JOIN SPEC_COND SC ON SC.SCID = G.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.STEDIZMER'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'WHERE G.GPDATE BETWEEN :date_begin AND :date_end'
      'AND SC.SCISDELETE IS NULL  AND APU.PID = :pid'
      'UNION'
      
        'SELECT P.PADATE, NULL AS SCID, '#39#1055#1054#1057#1058#1059#1055#1051#1045#1053#1048#1045' '#1057#1056#1045#1044#1057#1058#1042#39' AS STNAME, ' +
        #39#1088#1091#1073'.'#39' AS ed_izmer, NULL AS kol_ed,'
      'NULL AS SCTARIFWITHDISCOUNT,'
      'NULL AS PERIOD, NULL AS GPAMOUNT,'
      'P.PAAMOUNT AS oplata,'
      '('
      'SELECT SUM(sel.summa) + CAST(:prev_dolg AS D_FLOAT)'
      'FROM'
      '('
      'SELECT COALESCE(G1.GPAMOUNT,0) AS summa'
      'FROM SC_GRAFPLAT G1'
      'INNER JOIN SPEC_COND SC1 ON SC1.SCID = G1.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC1.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN SYS_DIC SD ON SD.SDID = ST.STEDIZMER'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC1.AGID'
      'WHERE G1.GPDATE BETWEEN :date_begin AND P.PADATE'
      'AND SC1.SCISDELETE IS NULL  AND APU.PID = :pid'
      'UNION'
      'SELECT (-1)*COALESCE(P1.PAAMOUNT, 0) AS summa'
      'FROM PAYMANTS_AGR P1'
      'WHERE P1.PAISDELETE IS NULL AND P1.PID_POLUCH = :pid'
      '    AND P1.PADATE BETWEEN :date_begin AND P.PADATE'
      '    AND P1.PAID <= P.PAID'
      ') AS sel) AS dolg'
      'FROM PAYMANTS_AGR P'
      'WHERE P.PAISDELETE IS NULL AND P.PID_POLUCH = :pid'
      '    AND P.PADATE BETWEEN :date_begin AND :date_end'
      'ORDER BY 1,2')
    Left = 368
    Top = 296
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'prev_dolg'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_end'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'prev_dolg'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_end'
        ParamType = ptUnknown
      end>
    object qPrintNextPaymentsGPDATE: TDateField
      FieldName = 'GPDATE'
      Origin = '"SC_GRAFPLAT"."GPDATE"'
    end
    object qPrintNextPaymentsSCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object qPrintNextPaymentsSTNAME: TIBStringField
      FieldName = 'STNAME'
      ProviderFlags = []
      Size = 276
    end
    object qPrintNextPaymentsED_IZMER: TIBStringField
      FieldName = 'ED_IZMER'
      Origin = '"SYS_DIC"."SDNAME"'
      Size = 255
    end
    object qPrintNextPaymentsKOL_ED: TIntegerField
      FieldName = 'KOL_ED'
      ProviderFlags = []
    end
    object qPrintNextPaymentsSCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintNextPaymentsPERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 26
    end
    object qPrintNextPaymentsGPAMOUNT: TIBBCDField
      FieldName = 'GPAMOUNT'
      Origin = '"SC_GRAFPLAT"."GPAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintNextPaymentsOPLATA: TIBBCDField
      FieldName = 'OPLATA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPrintNextPaymentsDOLG: TIBBCDField
      FieldName = 'DOLG'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
  end
  object frxqPrintBallance: TfrxDBDataset
    UserName = 'frxqPrintBallance'
    CloseDataSource = False
    DataSet = q1
    BCDToCurrency = False
    Left = 280
    Top = 328
  end
  object frxqPrintPrevBallance: TfrxDBDataset
    UserName = 'frxqPrintPrevBallance'
    CloseDataSource = False
    DataSet = qPrintPrevBallance
    BCDToCurrency = False
    Left = 320
    Top = 328
  end
  object frxqPrintNextPayments: TfrxDBDataset
    UserName = 'frxqPrintNextPayments'
    CloseDataSource = False
    DataSet = q3
    BCDToCurrency = False
    Left = 368
    Top = 328
  end
  object mdPrevBalance: TdxMemData
    Active = True
    Indexes = <>
    SortOptions = []
    Left = 408
    Top = 296
    object mdPrevBalanceid: TIntegerField
      FieldName = 'id'
    end
    object mdPrevBalanceprev_balance: TFloatField
      FieldName = 'prev_balance'
      DisplayFormat = '#,###0'
    end
    object mdPrevBalanceprev_balance2: TFloatField
      FieldName = 'prev_balance2'
      DisplayFormat = '#,###0'
    end
    object mdPrevBalanceprev_balance3: TFloatField
      FieldName = 'prev_balance3'
      DisplayFormat = '#,###0'
    end
  end
  object frxmdPrevBalance: TfrxDBDataset
    UserName = 'frxmdPrevBalance'
    CloseDataSource = False
    DataSet = mdPrevBalance
    BCDToCurrency = False
    Left = 408
    Top = 328
  end
  object q1: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    CachedUpdates = True
    SQL.Strings = (
      
        'SELECT FIRST 1 1 as id,  CAST(G.GPDATE||'#39' 00:40:00'#39' AS TIMESTAMP' +
        ') AS GPDATE, G.GPDATE AS GPDATE_print,'
      
        'SC.SCID, CAST('#39#1058#1088#1077#1073#1091#1077#1084#1099#1081' '#1087#1083#1072#1090#1077#1078#39' AS D_STR255) AS name_oper, ST.S' +
        'TNAME, COALESCE(S.SCOUNT,1) AS kol_ed,'
      'SC.SCTARIFWITHDISCOUNT,'
      'G.GPBEGINPERIOD, G.GPENDPERIOD, G.GPAMOUNT,'
      
        'cast( NULL as d_float) AS oplata, cast( NULL as d_float) AS opla' +
        'ta_bank_perc,'
      'cast( NULL as d_float) AS oplata_balance, 0 AS tip,'
      'CAST(0 AS D_FLOAT) AS dolg,'
      '('#39'c '#39'||G.GPBEGINPERIOD||'#39' '#1087#1086' '#39'||G.GPENDPERIOD) AS period'
      'FROM SC_GRAFPLAT G'
      'INNER JOIN SPEC_COND SC ON SC.SCID = G.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      '')
    UpdateObject = qu1
    Left = 280
    Top = 256
    object q1ID: TIntegerField
      FieldName = 'ID'
      ProviderFlags = []
    end
    object q1GPDATE: TDateTimeField
      FieldName = 'GPDATE'
      ProviderFlags = []
    end
    object q1SCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object q1STNAME: TIBStringField
      FieldName = 'STNAME'
      ProviderFlags = []
      Size = 276
    end
    object q1KOL_ED: TIntegerField
      FieldName = 'KOL_ED'
      ProviderFlags = []
    end
    object q1SCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q1GPAMOUNT: TIBBCDField
      FieldName = 'GPAMOUNT'
      Origin = '"SC_GRAFPLAT"."GPAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q1OPLATA: TIBBCDField
      FieldName = 'OPLATA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q1OPLATA_BANK_PERC: TIBBCDField
      FieldName = 'OPLATA_BANK_PERC'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q1OPLATA_BALANCE: TIBBCDField
      FieldName = 'OPLATA_BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q1GPDATE_PRINT: TDateField
      FieldName = 'GPDATE_PRINT'
      Origin = '"SC_GRAFPLAT"."GPDATE"'
    end
    object q1GPBEGINPERIOD: TDateField
      FieldName = 'GPBEGINPERIOD'
      Origin = '"SC_GRAFPLAT"."GPBEGINPERIOD"'
    end
    object q1GPENDPERIOD: TDateField
      FieldName = 'GPENDPERIOD'
      Origin = '"SC_GRAFPLAT"."GPENDPERIOD"'
    end
    object q1TIP: TIntegerField
      FieldName = 'TIP'
      ProviderFlags = []
    end
    object q1DOLG: TIBBCDField
      FieldName = 'DOLG'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q1NAME_OPER: TIBStringField
      FieldName = 'NAME_OPER'
      ProviderFlags = []
      Size = 255
    end
    object q1PERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 26
    end
  end
  object qu1: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  ID,'
      '  GPDATE,'
      '  GPDATE_PRINT,'
      '  SCID,'
      '  NAME_OPER,'
      '  STNAME,'
      '  KOL_ED,'
      '  SCTARIFWITHDISCOUNT,'
      '  GPBEGINPERIOD,'
      '  GPENDPERIOD,'
      '  GPAMOUNT,'
      '  OPLATA,'
      '  OPLATA_BANK_PERC,'
      '  OPLATA_BALANCE,'
      '  TIP,'
      '  DOLG,'
      '  PERIOD'
      'from SC_GRAFPLAT '
      'where'
      '  ID = :ID')
    ModifySQL.Strings = (
      'update SC_GRAFPLAT'
      'set'
      '  DOLG = :DOLG,'
      '  GPAMOUNT = :GPAMOUNT,'
      '  GPBEGINPERIOD = :GPBEGINPERIOD,'
      '  GPDATE = :GPDATE,'
      '  GPDATE_PRINT = :GPDATE_PRINT,'
      '  GPENDPERIOD = :GPENDPERIOD,'
      '  ID = :ID,'
      '  KOL_ED = :KOL_ED,'
      '  NAME_OPER = :NAME_OPER,'
      '  OPLATA = :OPLATA,'
      '  OPLATA_BALANCE = :OPLATA_BALANCE,'
      '  OPLATA_BANK_PERC = :OPLATA_BANK_PERC,'
      '  PERIOD = :PERIOD,'
      '  SCID = :SCID,'
      '  SCTARIFWITHDISCOUNT = :SCTARIFWITHDISCOUNT,'
      '  STNAME = :STNAME,'
      '  TIP = :TIP'
      'where'
      '  ID = :OLD_ID')
    InsertSQL.Strings = (
      'insert into SC_GRAFPLAT'
      
        '  (DOLG, GPAMOUNT, GPBEGINPERIOD, GPDATE, GPDATE_PRINT, GPENDPER' +
        'IOD, ID, '
      
        '   KOL_ED, NAME_OPER, OPLATA, OPLATA_BALANCE, OPLATA_BANK_PERC, ' +
        'PERIOD, '
      '   SCID, SCTARIFWITHDISCOUNT, STNAME, TIP)'
      'values'
      
        '  (:DOLG, :GPAMOUNT, :GPBEGINPERIOD, :GPDATE, :GPDATE_PRINT, :GP' +
        'ENDPERIOD, '
      
        '   :ID, :KOL_ED, :NAME_OPER, :OPLATA, :OPLATA_BALANCE, :OPLATA_B' +
        'ANK_PERC, '
      '   :PERIOD, :SCID, :SCTARIFWITHDISCOUNT, :STNAME, :TIP)')
    DeleteSQL.Strings = (
      'delete from SC_GRAFPLAT'
      'where'
      '  ID = :OLD_ID')
    Left = 312
    Top = 256
  end
  object q2: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      
        'SELECT CAST(G.GPDATE||'#39' 00:40:00'#39' AS TIMESTAMP) AS GPDATE, G.GPD' +
        'ATE AS GPDATE_print,'
      
        'SC.SCID, CAST('#39#1058#1088#1077#1073'. '#1087#1083#1072#1090#1077#1078#39' AS D_STR255) AS name_oper, ST.STNAM' +
        'E, COALESCE(S.SCOUNT,1) AS kol_ed,'
      'SC.SCTARIFWITHDISCOUNT,'
      'G.GPBEGINPERIOD, G.GPENDPERIOD, G.GPAMOUNT,'
      
        'cast( NULL as d_float) AS oplata, cast( NULL as d_float) AS opla' +
        'ta_bank_perc,'
      'cast( NULL as d_float) AS oplata_balance, 0 AS tip,'
      'CAST(0 AS D_FLOAT) AS dolg,'
      '('#39'c '#39'||G.GPBEGINPERIOD||'#39' '#1087#1086' '#39'||G.GPENDPERIOD) AS period'
      'FROM SC_GRAFPLAT G'
      'INNER JOIN SPEC_COND SC ON SC.SCID = G.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      'WHERE G.GPDATE BETWEEN :date_begin AND :date_end'
      'AND SC.SCISDELETE IS NULL  AND APU.PID = :pid'
      'UNION all'
      
        'SELECT P.PATIMEENTER  AS GPDATE, CAST(P.PATIMEENTER AS DATE) AS ' +
        'GPDATE_print,'
      'P.PAID AS SCID, CAST('#39#1055#1086#1089#1090'. '#1089#1088#1077#1076#1089#1090#1074#39' AS D_STR255) AS name_oper,'
      'IIF(P.JLID = 37, P.PANOTE, NULL) AS STNAME, NULL AS kol_ed,'
      'NULL AS SCTARIFWITHDISCOUNT,'
      'NULL AS GPBEGINPERIOD, NULL AS GPENDPERIOD, NULL AS GPAMOUNT,'
      
        'IIF(P.PAFORM = 0, P.PAAMOUNT, null) AS oplata, P.PABANKPERCENTS ' +
        'AS oplata_bank_perc,'
      'P.PAAMOUNTBALANCE AS oplata_balance, 1 AS tip,'
      'CAST(0 AS D_FLOAT) AS dolg,'
      'NULL AS period'
      'FROM PAYMANTS_AGR P'
      'WHERE P.PAISDELETE IS NULL AND P.PID_POLUCH = :pid'
      
        '    AND CAST(P.PATIMEENTER AS DATE) BETWEEN :date_begin AND :dat' +
        'e_end'
      'ORDER BY 1,2')
    Left = 280
    Top = 224
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_end'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_begin'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'date_end'
        ParamType = ptUnknown
      end>
    object q2GPDATE: TDateTimeField
      FieldName = 'GPDATE'
      ProviderFlags = []
    end
    object q2SCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
    end
    object q2STNAME: TIBStringField
      FieldName = 'STNAME'
      ProviderFlags = []
      Size = 276
    end
    object q2KOL_ED: TIntegerField
      FieldName = 'KOL_ED'
      ProviderFlags = []
    end
    object q2SCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      Precision = 18
      Size = 2
    end
    object q2GPAMOUNT: TIBBCDField
      FieldName = 'GPAMOUNT'
      Origin = '"SC_GRAFPLAT"."GPAMOUNT"'
      Precision = 18
      Size = 2
    end
    object q2OPLATA: TIBBCDField
      FieldName = 'OPLATA'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object q2OPLATA_BANK_PERC: TIBBCDField
      FieldName = 'OPLATA_BANK_PERC'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object q2OPLATA_BALANCE: TIBBCDField
      FieldName = 'OPLATA_BALANCE'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object q2TIP: TIntegerField
      FieldName = 'TIP'
      ProviderFlags = []
    end
    object q2GPDATE_PRINT: TDateField
      FieldName = 'GPDATE_PRINT'
      Origin = '"SC_GRAFPLAT"."GPDATE"'
    end
    object q2GPBEGINPERIOD: TDateField
      FieldName = 'GPBEGINPERIOD'
      Origin = '"SC_GRAFPLAT"."GPBEGINPERIOD"'
    end
    object q2GPENDPERIOD: TDateField
      FieldName = 'GPENDPERIOD'
      Origin = '"SC_GRAFPLAT"."GPENDPERIOD"'
    end
    object q2DOLG: TIBBCDField
      FieldName = 'DOLG'
      ProviderFlags = []
      Precision = 18
      Size = 2
    end
    object q2NAME_OPER: TIBStringField
      FieldName = 'NAME_OPER'
      ProviderFlags = []
      Size = 255
    end
    object q2PERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 26
    end
  end
  object q3: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    CachedUpdates = True
    SQL.Strings = (
      
        'SELECT FIRST 1 1 as id,  CAST(G.GPDATE||'#39' 00:40:00'#39' AS TIMESTAMP' +
        ') AS GPDATE, G.GPDATE AS GPDATE_print,'
      
        'SC.SCID, CAST('#39#1058#1088#1077#1073#1091#1077#1084#1099#1081' '#1087#1083#1072#1090#1077#1078#39' AS D_STR255) AS name_oper, ST.S' +
        'TNAME, COALESCE(S.SCOUNT,1) AS kol_ed,'
      'SC.SCTARIFWITHDISCOUNT,'
      'G.GPBEGINPERIOD, G.GPENDPERIOD, G.GPAMOUNT,'
      
        'cast( NULL as d_float) AS oplata, cast( NULL as d_float) AS opla' +
        'ta_bank_perc,'
      'cast( NULL as d_float) AS oplata_balance, 0 AS tip,'
      'CAST(0 AS D_FLOAT) AS dolg,'
      '('#39'c '#39'||G.GPBEGINPERIOD||'#39' '#1087#1086' '#39'||G.GPENDPERIOD) AS period'
      'FROM SC_GRAFPLAT G'
      'INNER JOIN SPEC_COND SC ON SC.SCID = G.SCID'
      'INNER JOIN SERVICES S ON S.SCID = SC.SCID'
      'INNER JOIN SERVICES_TYPE ST ON ST.STID = S.STID'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = SC.AGID'
      '')
    UpdateObject = qu3
    Left = 360
    Top = 256
    object q3ID: TIntegerField
      FieldName = 'ID'
      ProviderFlags = []
    end
    object q3GPDATE: TDateTimeField
      FieldName = 'GPDATE'
      ProviderFlags = []
    end
    object q3SCID: TIntegerField
      FieldName = 'SCID'
      Origin = '"SPEC_COND"."SCID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object q3STNAME: TIBStringField
      FieldName = 'STNAME'
      ProviderFlags = []
      Size = 276
    end
    object q3KOL_ED: TIntegerField
      FieldName = 'KOL_ED'
      ProviderFlags = []
    end
    object q3SCTARIFWITHDISCOUNT: TIBBCDField
      FieldName = 'SCTARIFWITHDISCOUNT'
      Origin = '"SPEC_COND"."SCTARIFWITHDISCOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q3OPLATA: TIBBCDField
      FieldName = 'OPLATA'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q3OPLATA_BANK_PERC: TIBBCDField
      FieldName = 'OPLATA_BANK_PERC'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q3OPLATA_BALANCE: TIBBCDField
      FieldName = 'OPLATA_BALANCE'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q3GPDATE_PRINT: TDateField
      FieldName = 'GPDATE_PRINT'
      Origin = '"SC_GRAFPLAT"."GPDATE"'
    end
    object q3GPBEGINPERIOD: TDateField
      FieldName = 'GPBEGINPERIOD'
      Origin = '"SC_GRAFPLAT"."GPBEGINPERIOD"'
    end
    object q3GPENDPERIOD: TDateField
      FieldName = 'GPENDPERIOD'
      Origin = '"SC_GRAFPLAT"."GPENDPERIOD"'
    end
    object q3TIP: TIntegerField
      FieldName = 'TIP'
      ProviderFlags = []
    end
    object q3GPAMOUNT: TIBBCDField
      FieldName = 'GPAMOUNT'
      Origin = '"SC_GRAFPLAT"."GPAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q3DOLG: TIBBCDField
      FieldName = 'DOLG'
      ProviderFlags = []
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object q3NAME_OPER: TIBStringField
      FieldName = 'NAME_OPER'
      ProviderFlags = []
      Size = 255
    end
    object q3PERIOD: TIBStringField
      FieldName = 'PERIOD'
      ProviderFlags = []
      Size = 26
    end
  end
  object qu3: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  ID,'
      '  GPDATE,'
      '  GPDATE_PRINT,'
      '  SCID,'
      '  NAME_OPER,'
      '  STNAME,'
      '  KOL_ED,'
      '  SCTARIFWITHDISCOUNT,'
      '  GPBEGINPERIOD,'
      '  GPENDPERIOD,'
      '  GPAMOUNT,'
      '  OPLATA,'
      '  OPLATA_BANK_PERC,'
      '  OPLATA_BALANCE,'
      '  TIP,'
      '  DOLG,'
      '  PERIOD'
      'from SC_GRAFPLAT '
      'where'
      '  ID = :ID')
    ModifySQL.Strings = (
      'update SC_GRAFPLAT'
      'set'
      '  DOLG = :DOLG,'
      '  GPAMOUNT = :GPAMOUNT,'
      '  GPBEGINPERIOD = :GPBEGINPERIOD,'
      '  GPDATE = :GPDATE,'
      '  GPDATE_PRINT = :GPDATE_PRINT,'
      '  GPENDPERIOD = :GPENDPERIOD,'
      '  ID = :ID,'
      '  KOL_ED = :KOL_ED,'
      '  NAME_OPER = :NAME_OPER,'
      '  OPLATA = :OPLATA,'
      '  OPLATA_BALANCE = :OPLATA_BALANCE,'
      '  OPLATA_BANK_PERC = :OPLATA_BANK_PERC,'
      '  PERIOD = :PERIOD,'
      '  SCID = :SCID,'
      '  SCTARIFWITHDISCOUNT = :SCTARIFWITHDISCOUNT,'
      '  STNAME = :STNAME,'
      '  TIP = :TIP'
      'where'
      '  ID = :OLD_ID')
    InsertSQL.Strings = (
      'insert into SC_GRAFPLAT'
      
        '  (DOLG, GPAMOUNT, GPBEGINPERIOD, GPDATE, GPDATE_PRINT, GPENDPER' +
        'IOD, ID, '
      
        '   KOL_ED, NAME_OPER, OPLATA, OPLATA_BALANCE, OPLATA_BANK_PERC, ' +
        'PERIOD, '
      '   SCID, SCTARIFWITHDISCOUNT, STNAME, TIP)'
      'values'
      
        '  (:DOLG, :GPAMOUNT, :GPBEGINPERIOD, :GPDATE, :GPDATE_PRINT, :GP' +
        'ENDPERIOD, '
      
        '   :ID, :KOL_ED, :NAME_OPER, :OPLATA, :OPLATA_BALANCE, :OPLATA_B' +
        'ANK_PERC, '
      '   :PERIOD, :SCID, :SCTARIFWITHDISCOUNT, :STNAME, :TIP)')
    DeleteSQL.Strings = (
      'delete from SC_GRAFPLAT'
      'where'
      '  ID = :OLD_ID')
    Left = 392
    Top = 256
  end
  object IBQuery1: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT DISTINCT DP.PID,'
      
        '(COALESCE(P.PLASTNAME,'#39' '#39')||'#39' '#39'||COALESCE(P.PNAME,'#39' '#39')||'#39' '#39'||COA' +
        'LESCE(P.PPATRONYMIC,'#39' '#39')) AS PP,'
      'P.PDATEBIRTH, ( SELECT FIRST 1 A.AGID'
      'FROM AGR_POLUCH_USLUG APU'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'WHERE APU.PID = DP.PID'
      'ORDER BY 1 DESC'
      ') AS AGID, ( SELECT FIRST 1 CAST(A.AGTIMEENTER AS DATE)'
      'FROM AGR_POLUCH_USLUG APU'
      'INNER JOIN AGREEMENTS A ON A.AGID = APU.AGID'
      'WHERE APU.PID = DP.PID'
      'ORDER BY 1 DESC'
      ') AS data'
      'FROM DETI_PODRAZD DP'
      'INNER JOIN'
      '('
      'SELECT t1.sdid'
      'FROM'
      '('
      'WITH   recursive'
      '   tree (SDNAME, SDID, SDPARID)'
      '   AS (SELECT SD.SDNAME, SD.SDID, sd.SDPARID FROM SYS_DIC SD'
      '      WHERE sd.SDPARID = 1400'
      '      UNION ALL'
      '      SELECT SD1.SDNAME, SD1.SDID, sd1.SDPARID'
      ''
      '      FROM SYS_DIC SD1'
      '          INNER JOIN tree t '
      '           ON t.sdid = sd1.SDPARID)'
      ' SELECT  SDNAME, SDID, SDPARID FROM tree t'
      ') AS t1'
      ') AS sd_osn ON sd_osn.sdid = DP.SDID'
      'INNER JOIN PEOPLE P ON P.PID = DP.PID'
      'INNER JOIN P_STATUS PS ON PS.PID = DP.PID'
      
        'WHERE ( COALESCE(CAST(dp.DPDATEOUT AS DATE), CURRENT_DATE+3650) ' +
        '>= '#39'01.04.2012'#39' and CAST(dp.DPDATEIN AS DATE) <= CURRENT_DATE)'
      'AND P.PISDELETE IS NULL  AND PS.SDID = 1246')
    Left = 12
    Top = 722
    object IBQuery1PID: TIntegerField
      FieldName = 'PID'
      Origin = '"DETI_PODRAZD"."PID"'
    end
    object IBQuery1PP: TIBStringField
      FieldName = 'PP'
      ProviderFlags = []
      Size = 767
    end
    object IBQuery1PDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object IBQuery1AGID: TIntegerField
      FieldName = 'AGID'
      ProviderFlags = []
    end
    object IBQuery1DATA: TDateField
      FieldName = 'DATA'
      ProviderFlags = []
    end
  end
  object frxDB: TfrxDBDataset
    UserName = 'frxDB'
    CloseDataSource = False
    DataSet = IBQuery1
    BCDToCurrency = False
    Left = 12
    Top = 754
  end
  object mdPeriod: TdxMemData
    Indexes = <>
    Persistent.Data = {
      5665728FC2F5285C8FFE3F040000000400000003000300696400140000000100
      05006E616D65000400000009000600626567696E000400000009000400656E64
      000101000000010D000000E4EE2031352E30382E3230313201E0300B00010936
      0B000102000000010C000000312DE920F2F0E8ECE5F1F2F0010A360B00017536
      0B000103000000010C000000322DE920F2F0E8ECE5F1F2F00176360B0001CF36
      0B000104000000010C000000332DE920F2F0E8ECE5F1F2F001D0360B00012B37
      0B000105000000010C000000342DE920F2F0E8ECE5F1F2F0012C370B00017637
      0B00}
    SortOptions = []
    Left = 440
    Top = 296
    object IntegerField2: TIntegerField
      FieldName = 'id'
    end
    object mdPeriodname: TStringField
      FieldName = 'name'
    end
    object mdPeriodbegin: TDateField
      FieldName = 'begin'
    end
    object mdPeriodend: TDateField
      FieldName = 'end'
    end
  end
  object dsPeriod: TDataSource
    DataSet = qPeriods
    Left = 472
    Top = 296
  end
  object sqlTempEnter: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'INSERT INTO KPP_TEMP_ENTER (ID, PID, NOTE, sdid)'
      'VALUES (GEN_ID(GEN_KPP_TEMP_ENTER_ID,1), :pid, :NOTE, :sdid)')
    Transaction = DMInv.IBTransaction1
    Left = 704
    Top = 296
  end
  object quRR: TIBUpdateSQL
    RefreshSQL.Strings = (
      'Select '
      '  RRID,'
      '  RRTYPE,'
      '  RID,'
      '  RRUSERENTER,'
      '  RRTIMEENTER,'
      '  RRUSEREDIT,'
      '  RRTIMEEDIT,'
      '  PID_POLUCH,'
      '  PID,'
      '  RRNOTE,'
      '  RRMANAGERNOTE,'
      '  RRMANAGER,'
      '  RRDIREKTORNOTE,'
      '  RRDIREKTOROK,'
      '  RRCLIENTANSWER,'
      '  RRISDELETE'
      'from REGISTR_REQUEST '
      'where'
      '  RRID = :RRID')
    ModifySQL.Strings = (
      'update REGISTR_REQUEST'
      'set'
      '  RRCLIENTANSWER = :RRCLIENTANSWER,'
      '  RRDIREKTORNOTE = :RRDIREKTORNOTE,'
      '  RRDIREKTOROK = :RRDIREKTOROK,'
      '  RRMANAGERNOTE = :RRMANAGERNOTE'
      'where'
      '  RRID = :OLD_RRID')
    InsertSQL.Strings = (
      'insert into REGISTR_REQUEST'
      '  (RRCLIENTANSWER, RRDIREKTORNOTE, RRDIREKTOROK, RRMANAGERNOTE)'
      'values'
      
        '  (:RRCLIENTANSWER, :RRDIREKTORNOTE, :RRDIREKTOROK, :RRMANAGERNO' +
        'TE)')
    DeleteSQL.Strings = (
      'delete from REGISTR_REQUEST'
      'where'
      '  RRID = :OLD_RRID')
    Left = 995
    Top = 689
  end
  object qSCagrid: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    DataSource = dlgDS
    SQL.Strings = (
      'SELECT A.AGID,  A.AGID as name'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE A.AGISDELETE IS NULL'
      'AND APU.PID = :pid')
    Left = 220
    Top = 653
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qSCagridAGID: TIntegerField
      FieldName = 'AGID'
      Origin = '"AGREEMENTS"."AGID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qSCagridNAME: TIntegerField
      FieldName = 'NAME'
      Origin = '"AGREEMENTS"."AGID"'
      Required = True
    end
  end
  object dsSCagrid: TDataSource
    DataSet = qSCagrid
    Left = 252
    Top = 653
  end
  object sqlSetNewAgid: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE SPEC_COND SC SET SC.AGID = :agid'
      'WHERE SC.SCID = :scid')
    Transaction = DMInv.IBTransaction1
    Left = 284
    Top = 645
  end
  object sqlSetPANewAGID: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE PAYMANTS_AGR PA SET PA.AGRID = :new_agid'
      'WHERE PA.CSID IN'
      '('
      'SELECT DISTINCT C.CSID'
      'FROM "COMMON" C'
      'WHERE C.SCID = :scid'
      ')')
    Transaction = DMInv.IBTransaction1
    Left = 316
    Top = 645
  end
  object qCheckTempEnter: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.IBTransaction1
    SQL.Strings = (
      'SELECT t.ID'
      'FROM KPP_TEMP_ENTER t'
      'WHERE t.PID = :pid'
      
        'AND CURRENT_TIMESTAMP BETWEEN t.TIMEENTER AND (T.TIMEENTER + 0.0' +
        '416)')
    Left = 736
    Top = 296
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
  end
  object qDolg: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'EXECUTE PROCEDURE SP_BALANCE (:PID)')
    Transaction = DMInv.trWrite
    Left = 784
    Top = 301
  end
  object qExtraService: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      'select EU.*'
      'from SC_EXTRA_USLUGA$VW_EXT(:IN_SCID) EU')
    Left = 1128
    Top = 683
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'IN_SCID'
        ParamType = ptUnknown
      end>
  end
  object dsExtraService: TDataSource
    DataSet = qExtraService
    Left = 1090
    Top = 685
  end
  object alDetiView: TActionList
    Images = DMInv.cxSmallImages
    Left = 1118
    Top = 285
    object actExtraServiceAdd: TAction
      Category = 'ExtraServices'
      Caption = #1044#1086#1073#1072#1074#1080#1090#1100
      Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1085#1077#1086#1082#1072#1079#1072#1085#1085#1099#1077' '#1079#1072#1085#1103#1090#1080#1103
      ImageIndex = 40
      OnExecute = actExtraServiceAddExecute
    end
    object actExtraServiceDelete: TAction
      Category = 'ExtraServices'
      Caption = #1059#1076#1072#1083#1080#1090#1100
      Hint = #1059#1076#1072#1083#1080#1090#1100' '#1085#1077#1086#1082#1072#1079#1072#1085#1085#1099#1077' '#1079#1072#1085#1103#1090#1080#1103
      ImageIndex = 10
      Visible = False
      OnExecute = actExtraServiceDeleteExecute
      OnUpdate = actExtraServiceDeleteUpdate
    end
  end
  object qExtraServiceUpdateOrInsert: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trWrite
    SQL.Strings = (
      'select EU.OUT_ID, EU.OUT_ERROR'
      
        'from SC_EXTRA_USLUGA$EDIT(:AOPERATION, :ID, :SCID, :KOL, :IS_ADD' +
        ') EU')
    Left = 1049
    Top = 686
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'AOPERATION'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'ID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'SCID'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'KOL'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'IS_ADD'
        ParamType = ptUnknown
      end>
  end
  object qCheckIsAdditionalService: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      'select ST.*'
      'from SERVICES_TYPE ST'
      'inner join (select T1.*'
      '            from (with recursive TREE as'
      '                       (select SD.SDNAME, SD.SDID, SD.SDPARID'
      '                        from SYS_DIC SD'
      '                        where SD.SDPARID = 1881'
      '                        union all'
      '                        select SD1.SDNAME, SD1.SDID, SD1.SDPARID'
      '                        from SYS_DIC SD1'
      
        '                        inner join TREE T on T.SDID = SD1.SDPARI' +
        'D)'
      '                  select SDNAME,'
      '                         SDID,'
      '                         SDPARID'
      
        '                 from TREE T) as T1) as SEL on SEL.SDID = ST.SDI' +
        'D'
      'where (ST.STID = :STID)')
    Left = 796
    Top = 747
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'STID'
        ParamType = ptUnknown
      end>
  end
  object frxDBPhoto: TfrxDBDataset
    UserName = 'frxDBPhoto'
    CloseDataSource = False
    FieldAliases.Strings = (
      'FNUMBER=FNUMBER'
      'FCOUNT=FCOUNT')
    OpenDataSource = False
    DataSet = qSvcPhoto
    BCDToCurrency = False
    Left = 540
    Top = 614
  end
  object qSvcPhoto: TpFIBDataSet
    SelectSQL.Strings = (
      'select fnumber,fcount'
      'from SERVICES_PHOTO'
      'where sid = :SID'
      'order by fnumber')
    AutoUpdateOptions.UpdateTableName = 'SERVICES_PHOTO'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.AutoParamsToFields = True
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    UpdateTransaction = DMInv.trFibWrite
    Left = 584
    Top = 600
    oFetchAll = True
    object qSvcPhotoFNUMBER: TStringField
      FieldName = 'FNUMBER'
      Size = 10
    end
    object qSvcPhotoFCOUNT: TIntegerField
      FieldName = 'FCOUNT'
    end
  end
  object qPaymants_Agr: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    DataSource = dlgDS
    SQL.Strings = (
      
        'SELECT pa.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P' +
        '_res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      
        'IIF(pa.PID IS NOT NULL, (P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||COALESC' +
        'E(P.PPATRONYMIC,'#39' '#39')), COALESCE(sd.SDNAME, jl.JLOPF)||'#39' "'#39'||jl.J' +
        'LEGALNAME||'#39'" '#39') AS plat,'
      'IIF(pa.PAFORM = 0,'#39#1053#1072#1083'.'#39','#39#1041'/'#1085#39') AS tip, p_res.PDATEBIRTH,'
      
        '(P_prinyal.PLASTNAME||'#39' '#39'||P_prinyal.PNAME||'#39' '#39'||COALESCE(P_prin' +
        'yal.PPATRONYMIC,'#39' '#39')) AS P_usermoney'
      'FROM PAYMANTS_AGR pa'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = pa.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P ON P.PID = pa.PID'
      
        'LEFT OUTER JOIN PEOPLE P_prinyal ON P_prinyal.PID = pa.PAUSERMON' +
        'EY'
      'LEFT OUTER JOIN JURLITSA JL ON JL.JLID = pa.JLID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = JL.JLOPFSDID'
      'WHERE pa.PID_POLUCH = :PID')
    Left = 707
    Top = 370
    ParamData = <
      item
        DataType = ftInteger
        Name = 'PID'
        ParamType = ptUnknown
        Size = 4
      end>
    object qPaymants_AgrPAID: TIntegerField
      FieldName = 'PAID'
      Origin = '"PAYMANTS_AGR"."PAID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qPaymants_AgrAGRID: TIntegerField
      FieldName = 'AGRID'
      Origin = '"PAYMANTS_AGR"."AGRID"'
    end
    object qPaymants_AgrPID_POLUCH: TIntegerField
      FieldName = 'PID_POLUCH'
      Origin = '"PAYMANTS_AGR"."PID_POLUCH"'
    end
    object qPaymants_AgrPAFORM: TIntegerField
      FieldName = 'PAFORM'
      Origin = '"PAYMANTS_AGR"."PAFORM"'
    end
    object qPaymants_AgrPAAMOUNT: TIBBCDField
      FieldName = 'PAAMOUNT'
      Origin = '"PAYMANTS_AGR"."PAAMOUNT"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPaymants_AgrPABANKPERCENTS: TIBBCDField
      FieldName = 'PABANKPERCENTS'
      Origin = '"PAYMANTS_AGR"."PABANKPERCENTS"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPaymants_AgrPAAMOUNTBALANCE: TIBBCDField
      FieldName = 'PAAMOUNTBALANCE'
      Origin = '"PAYMANTS_AGR"."PAAMOUNTBALANCE"'
      DisplayFormat = '#,###0'
      Precision = 18
      Size = 2
    end
    object qPaymants_AgrPADATE: TDateField
      FieldName = 'PADATE'
      Origin = '"PAYMANTS_AGR"."PADATE"'
    end
    object qPaymants_AgrPID: TIntegerField
      FieldName = 'PID'
      Origin = '"PAYMANTS_AGR"."PID"'
    end
    object qPaymants_AgrPANOTE: TIBStringField
      FieldName = 'PANOTE'
      Origin = '"PAYMANTS_AGR"."PANOTE"'
      Size = 255
    end
    object qPaymants_AgrPAUSERENTER: TIBStringField
      FieldName = 'PAUSERENTER'
      Origin = '"PAYMANTS_AGR"."PAUSERENTER"'
      Size = 40
    end
    object qPaymants_AgrPATIMEENTER: TDateTimeField
      FieldName = 'PATIMEENTER'
      Origin = '"PAYMANTS_AGR"."PATIMEENTER"'
    end
    object qPaymants_AgrPAUSEREDIT: TIBStringField
      FieldName = 'PAUSEREDIT'
      Origin = '"PAYMANTS_AGR"."PAUSEREDIT"'
      Size = 40
    end
    object qPaymants_AgrPATIMEEDIT: TDateTimeField
      FieldName = 'PATIMEEDIT'
      Origin = '"PAYMANTS_AGR"."PATIMEEDIT"'
    end
    object qPaymants_AgrPAISDELETE: TIntegerField
      FieldName = 'PAISDELETE'
      Origin = '"PAYMANTS_AGR"."PAISDELETE"'
    end
    object qPaymants_AgrPANUMUSER: TIntegerField
      FieldName = 'PANUMUSER'
      Origin = '"PAYMANTS_AGR"."PANUMUSER"'
    end
    object qPaymants_AgrJLID: TIntegerField
      FieldName = 'JLID'
      Origin = '"PAYMANTS_AGR"."JLID"'
    end
    object qPaymants_AgrPAUSERMONEY: TIntegerField
      FieldName = 'PAUSERMONEY'
      Origin = '"PAYMANTS_AGR"."PAUSERMONEY"'
    end
    object qPaymants_AgrBPID: TIntegerField
      FieldName = 'BPID'
      Origin = '"PAYMANTS_AGR"."BPID"'
    end
    object qPaymants_AgrRPID: TIntegerField
      FieldName = 'RPID'
      Origin = '"PAYMANTS_AGR"."RPID"'
    end
    object qPaymants_AgrCSID: TIntegerField
      FieldName = 'CSID'
      Origin = '"PAYMANTS_AGR"."CSID"'
    end
    object qPaymants_AgrP_RECIPIENT: TIBStringField
      FieldName = 'P_RECIPIENT'
      ProviderFlags = []
      Size = 767
    end
    object qPaymants_AgrPLAT: TIBStringField
      FieldName = 'PLAT'
      ProviderFlags = []
      Size = 767
    end
    object qPaymants_AgrTIP: TIBStringField
      FieldName = 'TIP'
      ProviderFlags = []
      FixedChar = True
      Size = 4
    end
    object qPaymants_AgrPDATEBIRTH: TDateField
      FieldName = 'PDATEBIRTH'
      Origin = '"PEOPLE"."PDATEBIRTH"'
    end
    object qPaymants_AgrP_USERMONEY: TIBStringField
      FieldName = 'P_USERMONEY'
      ProviderFlags = []
      Size = 767
    end
  end
  object dsPaymants_Agr: TDataSource
    DataSet = qPaymants_Agr
    OnDataChange = dsPaymants_AgrDataChange
    Left = 672
    Top = 368
  end
  object qPaymants_Agr_tmp: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      
        'SELECT pa.*, (P_res.PLASTNAME||'#39' '#39'||P_res.PNAME||'#39' '#39'||COALESCE(P' +
        '_res.PPATRONYMIC,'#39' '#39')) AS P_RECIPIENT,'
      
        'IIF(pa.PID IS NOT NULL, (P.PLASTNAME||'#39' '#39'||P.PNAME||'#39' '#39'||COALESC' +
        'E(P.PPATRONYMIC,'#39' '#39')), COALESCE(sd.SDNAME, jl.JLOPF)||'#39' "'#39'||jl.J' +
        'LEGALNAME||'#39'" '#39') AS plat,'
      'IIF(pa.PAFORM = 0,'#39#1053#1072#1083'.'#39','#39#1041'/'#1085#39') AS tip, p_res.PDATEBIRTH,'
      
        '(P_prinyal.PLASTNAME||'#39' '#39'||P_prinyal.PNAME||'#39' '#39'||COALESCE(P_prin' +
        'yal.PPATRONYMIC,'#39' '#39')) AS P_usermoney'
      'FROM PAYMANTS_AGR pa'
      'LEFT OUTER JOIN PEOPLE P_res ON P_res.PID = pa.PID_POLUCH'
      'LEFT OUTER JOIN PEOPLE P ON P.PID = pa.PID'
      
        'LEFT OUTER JOIN PEOPLE P_prinyal ON P_prinyal.PID = pa.PAUSERMON' +
        'EY'
      'LEFT OUTER JOIN JURLITSA JL ON JL.JLID = pa.JLID'
      'LEFT OUTER JOIN SYS_DIC SD ON SD.SDID = JL.JLOPFSDID'
      'WHERE pa.PID_POLUCH = :PID')
    Left = 739
    Top = 370
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'PID'
        ParamType = ptUnknown
      end>
  end
  object frqPaymants_Agr: TfrxDBDataset
    UserName = 'frqPaymants_Agr'
    CloseDataSource = False
    DataSet = qPaymants_Agr
    BCDToCurrency = False
    Left = 707
    Top = 404
  end
  object sqlDel_Paymants_Agr: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE PAYMANTS_AGR pa'
      
        'SET pa.PAISDELETE = 1, pa.PANOTE = COALESCE(pa.PANOTE, '#39' '#39') || '#39 +
        ' '#1055#1088#1080#1095#1080#1085#1072' '#1091#1076#1072#1083#1077#1085#1080#1103': '#39'||CAST(:txt AS D_STR80)'
      'WHERE pa.PAID = :paid')
    Transaction = DMInv.trWrite
    Left = 776
    Top = 373
  end
  object sqlUndelete_paymants_agr: TIBSQL
    Database = DMInv.DBRead
    SQL.Strings = (
      'UPDATE PAYMANTS_AGR PA'
      'set pa.PAISDELETE = NULL'
      'WHERE pa.PAID = :paid')
    Transaction = DMInv.trWrite
    Left = 816
    Top = 373
  end
  object qPeriods: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      
        'SELECT p.ID, (p."NO" || '#39'-'#1081' '#1090#1088#1080#1084#1077#1089#1090#1088#39') AS trimestr, p.BEGDATE, p' +
        '.ENDDATE'
      'FROM PERIODS p'
      'ORDER BY 3')
    Left = 512
    Top = 296
    object qPeriodsID: TIntegerField
      FieldName = 'ID'
      Origin = '"PERIODS"."ID"'
      ProviderFlags = [pfInUpdate, pfInWhere, pfInKey]
      Required = True
    end
    object qPeriodsTRIMESTR: TIBStringField
      FieldName = 'TRIMESTR'
      ProviderFlags = []
      Size = 22
    end
    object qPeriodsBEGDATE: TDateField
      FieldName = 'BEGDATE'
      Origin = '"PERIODS"."BEGDATE"'
    end
    object qPeriodsENDDATE: TDateField
      FieldName = 'ENDDATE'
      Origin = '"PERIODS"."ENDDATE"'
    end
  end
  object qAgrMaxDate: TIBQuery
    Database = DMInv.DBRead
    Transaction = DMInv.trRead
    SQL.Strings = (
      
        'SELECT IIF(max(A.AGDATEEND) < CURRENT_DATE, CURRENT_DATE, max(A.' +
        'AGDATEEND)) AS data'
      'FROM AGREEMENTS A'
      'INNER JOIN AGR_POLUCH_USLUG APU ON APU.AGID = A.AGID'
      'WHERE a.AGISDELETE IS NULL'
      'AND apu.PID = :pid')
    Left = 544
    Top = 296
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'pid'
        ParamType = ptUnknown
      end>
    object qAgrMaxDateDATA: TDateField
      FieldName = 'DATA'
      ProviderFlags = []
    end
  end
  object frxDBHours: TfrxDBDataset
    UserName = 'frxDBHours'
    CloseDataSource = False
    FieldAliases.Strings = (
      'MCAPTION=MCAPTION'
      'MDOZE=MDOZE'
      'MCOUNT=MCOUNT'
      'SMHOUR=SMHOUR')
    OpenDataSource = False
    DataSet = qHours
    BCDToCurrency = False
    Left = 548
    Top = 662
  end
  object qHours: TpFIBDataSet
    SelectSQL.Strings = (
      'select sm.mcaption, sm.mdoze, sm.mcount, mt.smhour'
      'from SERVICES_MED sm'
      'join SERVICES_MED_TIME mt on mt.smid = sm.smid'
      'where sm.scid = :SCID'
      'order by smhour')
    AutoUpdateOptions.UpdateTableName = 'SERVICES_PHOTO'
    AutoUpdateOptions.AutoReWriteSqls = True
    AutoUpdateOptions.CanChangeSQLs = True
    AutoUpdateOptions.AutoParamsToFields = True
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    UpdateTransaction = DMInv.trFibWrite
    Left = 576
    Top = 704
    oFetchAll = True
    object qHoursMCAPTION: TFIBStringField
      FieldName = 'MCAPTION'
      Size = 255
      EmptyStrToNull = True
    end
    object qHoursMDOZE: TFIBBCDField
      FieldName = 'MDOZE'
      DisplayFormat = '#,##0.00'
      EditFormat = '0.00'
      Size = 2
      RoundByScale = True
    end
    object qHoursMCOUNT: TFIBIntegerField
      FieldName = 'MCOUNT'
    end
    object qHoursSMHOUR: TFIBIntegerField
      FieldName = 'SMHOUR'
    end
  end
  object dsHours: TDataSource
    DataSet = qHours
    Left = 643
    Top = 727
  end
  object dsq1: TDataSource
    DataSet = q1
    Left = 248
    Top = 257
  end
end
